Skip to content

Commit 5a0dca3

Browse files
committed
edits
1 parent a0c361b commit 5a0dca3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

django_mongodb/compiler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def pre_sql_setup(self, with_col_aliases=False):
257257
having = self.having.replace_expressions(all_replacements).as_mql(
258258
self, self.connection
259259
)
260-
# Add having subqueries.
260+
# Add HAVING subqueries.
261261
for query in self.subqueries or ():
262262
pipeline.extend(query.get_pipeline())
263263
# Clean added subqueries.
@@ -685,7 +685,9 @@ def execute_sql(self, result_type=MULTI):
685685
def check_query(self):
686686
super().check_query()
687687
if not self.single_alias:
688-
raise NotSupportedError("Cannot use QuerySet.delete() when a subquery is required.")
688+
raise NotSupportedError(
689+
"Cannot use QuerySet.delete() when querying across multiple collections on MongoDB."
690+
)
689691

690692
def get_where(self):
691693
return self.query.where

django_mongodb/query_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ def process_rhs(node, compiler, connection):
3434
value = rhs.as_mql(compiler, connection)
3535
else:
3636
_, value = node.process_rhs(compiler, connection)
37+
lookup_name = node.lookup_name
3738
# Undo Lookup.get_db_prep_lookup() putting params in a list.
38-
if node.lookup_name not in ("in", "range"):
39+
if lookup_name not in ("in", "range"):
3940
value = value[0]
4041
if hasattr(node, "prep_lookup_value_mongo"):
4142
value = node.prep_lookup_value_mongo(value)

0 commit comments

Comments
 (0)