diff --git a/django_mongodb/compiler.py b/django_mongodb/compiler.py index b96e27321..1d2398777 100644 --- a/django_mongodb/compiler.py +++ b/django_mongodb/compiler.py @@ -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. diff --git a/django_mongodb/query.py b/django_mongodb/query.py index f941f3c1e..c5b4ad7c6 100644 --- a/django_mongodb/query.py +++ b/django_mongodb/query.py @@ -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 @@ -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: @@ -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