Skip to content

Commit 9636af4

Browse files
committed
Moving auxiliar function and fix typo.
1 parent 19ef267 commit 9636af4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

django_mongodb/fields/json_field.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818
from django_mongodb.query_utils import process_lhs, process_rhs
1919

2020

21-
def _key_transform_root(self, compiler, connection):
22-
previous = self.lhs
23-
while isinstance(previous, KeyTransform):
24-
previous = previous.lhs
25-
return previous.as_mql(compiler, connection)
26-
27-
2821
def contained_by(self, compiler, connection): # noqa: ARG001
2922
raise NotSupportedError("contained_by lookup is not supported on this database backend.")
3023

@@ -38,7 +31,7 @@ def data_contains(self, compiler, connection): # noqa: ARG001
3831

3932
def from_db_value(self, value, expression, connection):
4033
"""
41-
Mongodb does not need to change the json value. It is store as it is.
34+
MongoDB does not need to change the json value. It is stored as it is.
4235
"""
4336
return (
4437
value
@@ -122,6 +115,13 @@ def key_transform_in(self, compiler, connection):
122115
return {"$and": [expr, type_in]}
123116

124117

118+
def _key_transform_root(self, compiler, connection):
119+
previous = self.lhs
120+
while isinstance(previous, KeyTransform):
121+
previous = previous.lhs
122+
return previous.as_mql(compiler, connection)
123+
124+
125125
def key_transform_isnull(self, compiler, connection):
126126
"""
127127
The KeyTransformIsNull lookup borrows the logic from HasKey for isnull=False.

0 commit comments

Comments
 (0)