Skip to content
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
6 changes: 5 additions & 1 deletion django_mongodb/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,11 @@ def get_project_fields(self, columns=None, ordering=None, force_expression=False
else expr.as_mql(self, self.connection)
)
except EmptyResultSet:
fields[collection][name] = Value(False).as_mql(self, self.connection)
empty_result_set_value = getattr(expr, "empty_result_set_value", NotImplemented)
value = (
False if empty_result_set_value is NotImplemented else empty_result_set_value
)
fields[collection][name] = Value(value).as_mql(self, self.connection)
except FullResultSet:
fields[collection][name] = Value(True).as_mql(self, self.connection)
# Annotations (stored in None) and the main collection's fields
Expand Down
4 changes: 0 additions & 4 deletions django_mongodb/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
"backends.tests.ThreadTests.test_pass_connection_between_threads",
"backends.tests.ThreadTests.test_closing_non_shared_connections",
"backends.tests.ThreadTests.test_default_connection_thread_local",
# Column default values aren't handled when a field raises
# EmptyResultSet: https://github.com/mongodb-labs/django-mongodb/issues/155
"annotations.tests.NonAggregateAnnotationTestCase.test_empty_queryset_annotation",
"db_functions.comparison.test_coalesce.CoalesceTests.test_empty_queryset",
# Union as subquery is not mapping the parent parameter and collections:
# https://github.com/mongodb-labs/django-mongodb/issues/156
"queries.test_qs_combinators.QuerySetSetOperationTests.test_union_in_subquery_related_outerref",
Expand Down