Skip to content

made empty query handling use NothingNode #93

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 2 commits into from
Aug 5, 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
2 changes: 0 additions & 2 deletions django_mongodb/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ def cursor_iter(self, cursor, chunk_size, columns):

def check_query(self):
"""Check if the current query is supported by the database."""
if self.query.is_empty():
raise EmptyResultSet()
if self.query.distinct or getattr(
# In the case of Query.distinct().count(), the distinct attribute
# will be set on the inner_query.
Expand Down
5 changes: 2 additions & 3 deletions django_mongodb/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.db.models.lookups import Exact
from django.db.models.sql.constants import INNER
from django.db.models.sql.datastructures import Join
from django.db.models.sql.where import AND, OR, XOR, WhereNode
from django.db.models.sql.where import AND, OR, XOR, NothingNode, WhereNode
from pymongo import ASCENDING, DESCENDING
from pymongo.errors import DuplicateKeyError, PyMongoError

Expand Down Expand Up @@ -97,8 +97,6 @@ def get_cursor(self, count=False, limit=None, skip=None):

Use `limit` or `skip` to override those options of the query.
"""
if self.query.low_mark == self.query.high_mark:
return []
fields = {}
for name, expr in self.columns or []:
try:
Expand Down Expand Up @@ -284,4 +282,5 @@ def where_node(self, compiler, connection):

def register_nodes():
Join.as_mql = join
NothingNode.as_mql = NothingNode.as_sql
WhereNode.as_mql = where_node