Skip to content

Commit 3bfeeb7

Browse files
committed
rename MongoQuery.mongo_query to match_mql
1 parent 6a038b0 commit 3bfeeb7

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

django_mongodb/compiler.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,9 @@ def build_query(self, columns=None):
386386
try:
387387
expr = where.as_mql(self, self.connection) if where else {}
388388
except FullResultSet:
389-
query.mongo_query = {}
389+
query.match_mql = {}
390390
else:
391-
query.mongo_query = {"$expr": expr}
391+
query.match_mql = {"$expr": expr}
392392
if extra_fields:
393393
query.extra_fields = self.get_project_fields(extra_fields, force_expression=True)
394394
query.subqueries = self.subqueries
@@ -722,7 +722,7 @@ def execute_sql(self, result_type):
722722
prepared = prepared.as_mql(self, self.connection)
723723
values[field.column] = prepared
724724
try:
725-
criteria = self.build_query().mongo_query
725+
criteria = self.build_query().match_mql
726726
except EmptyResultSet:
727727
return 0
728728
is_empty = not bool(values)

django_mongodb/query.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, compiler):
4545
self.compiler = compiler
4646
self.query = compiler.query
4747
self.ordering = []
48-
self.mongo_query = {}
48+
self.match_mql = {}
4949
self.subqueries = None
5050
self.lookup_pipeline = None
5151
self.project_fields = None
@@ -64,14 +64,14 @@ def collection(self):
6464
return self.compiler.collection
6565

6666
def __repr__(self):
67-
return f"<MongoQuery: {self.mongo_query!r} ORDER {self.ordering!r}>"
67+
return f"<MongoQuery: {self.match_mql!r} ORDER {self.ordering!r}>"
6868

6969
@wrap_database_errors
7070
def delete(self):
7171
"""Execute a delete query."""
7272
if self.compiler.subqueries:
7373
raise NotSupportedError("Cannot use QuerySet.delete() when a subquery is required.")
74-
return self.collection.delete_many(self.mongo_query).deleted_count
74+
return self.collection.delete_many(self.match_mql).deleted_count
7575

7676
@wrap_database_errors
7777
def get_cursor(self):
@@ -87,8 +87,8 @@ def get_pipeline(self):
8787
pipeline.extend(self.lookup_pipeline)
8888
for query in self.subqueries or ():
8989
pipeline.extend(query.get_pipeline())
90-
if self.mongo_query:
91-
pipeline.append({"$match": self.mongo_query})
90+
if self.match_mql:
91+
pipeline.append({"$match": self.match_mql})
9292
if self.aggregation_pipeline:
9393
pipeline.extend(self.aggregation_pipeline)
9494
if self.project_fields:

0 commit comments

Comments
 (0)