Skip to content

raise NotSupportedError for QuerySet.prefetch_related() #75

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

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Migrations for 'admin':
- `datetimes()`
- `distinct()`
- `extra()`
- `prefetch_related()`

- `Subquery`, `Exists`, and using a `QuerySet` in `QuerySet.annotate()` aren't
supported.
Expand Down
2 changes: 2 additions & 0 deletions django_mongodb/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def check_query(self):
raise NotSupportedError("QuerySet.dates() is not supported on MongoDB.")
raise NotSupportedError("QuerySet.distinct() is not supported on MongoDB.")
if self.query.extra:
if any(key.startswith("_prefetch_related_") for key in self.query.extra):
raise NotSupportedError("QuerySet.prefetch_related() is not supported on MongoDB.")
raise NotSupportedError("QuerySet.extra() is not supported on MongoDB.")
if any(
isinstance(a, Aggregate) and not isinstance(a, Count)
Expand Down