Skip to content

Add django-mongodb-backend support #9656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

aclark4life
Copy link

Hello! I'm working on 3rd party library integration for Django MongoDB Backend e.g.

Description

This draft PR adds an ObjectIdRestField to DRF for use with Django MongoDB Backend. With this PR, many DRF test suite errors change from expected int, got ObjectId to errors like:

___________________________________________________________________________ SearchFilterTests.test_search_field_with_custom_lookup ____________________________________________________________________________
tests/test_filters.py:225: in test_search_field_with_custom_lookup
    assert response.data == [
E   AssertionError: assert [{'id': '67be...text': 'abc'}] == [{'id': 1, 't...'title': 'z'}]
E     
E     At index 0 diff: {'id': '67be0f743ca9f525d672ebcc', 'title': 'z', 'text': 'abc'} != {'id': 1, 'title': 'z'
E     
E     ...Full output truncated (2 lines hidden), use '-vv' to show

Many of these errors can be fixed by removing hard coded pks similar to carltongibson/django-filter#1703.

Planning to remove hard coded pks in a future commit after which I'll remove draft status. Any and all feedback appreciated!

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR is out of the scope of this project. I suggest you send a PR to drf-extensions

@auvipy auvipy closed this Feb 26, 2025
@aclark4life
Copy link
Author

Thank you! I will check out https://github.com/chibisov/drf-extensions

@aclark4life
Copy link
Author

@auvipy Actually, now that I think about it, there is nothing MongoDB specific in here … we're interested in updating the test suites of various 3rd party libraries so that both int and ObjectID pks can pass. E.g.

Please consider having another look! Thank you 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants