14
14
from django_mongodb_backend .fields import ArrayField
15
15
16
16
from .query_utils import process_rhs
17
- from .utils import get_column_path
17
+ from .utils import get_column
18
18
19
19
MONGO_INDEX_OPERATORS = {
20
20
"exact" : "$eq" ,
@@ -63,7 +63,7 @@ def get_pymongo_index_model(self, model, schema_editor, field=None, unique=False
63
63
filter_expression [column ].update ({"$type" : field .db_type (schema_editor .connection )})
64
64
else :
65
65
for field_name , _ in self .fields_orders :
66
- field_ = get_column_path (model , field_name )
66
+ field_ = get_column (model , field_name )
67
67
filter_expression [field_ .column ].update (
68
68
{"$type" : field_ .db_type (schema_editor .connection )}
69
69
)
@@ -76,7 +76,7 @@ def get_pymongo_index_model(self, model, schema_editor, field=None, unique=False
76
76
# order is "" if ASCENDING or "DESC" if DESCENDING (see
77
77
# django.db.models.indexes.Index.fields_orders).
78
78
(
79
- column_prefix + get_column_path (model , field_name ).column ,
79
+ column_prefix + get_column (model , field_name ).column ,
80
80
ASCENDING if order == "" else DESCENDING ,
81
81
)
82
82
for field_name , order in self .fields_orders
@@ -156,7 +156,7 @@ def get_pymongo_index_model(
156
156
for field_name , _ in self .fields_orders :
157
157
field = model ._meta .get_field (field_name )
158
158
type_ = self .search_index_data_types (field .db_type (schema_editor .connection ))
159
- field_path = column_prefix + get_column_path (model , field_name ).column
159
+ field_path = column_prefix + get_column (model , field_name ).column
160
160
fields [field_path ] = {"type" : type_ }
161
161
return SearchIndexModel (
162
162
definition = {"mappings" : {"dynamic" : False , "fields" : fields }}, name = self .name
@@ -266,7 +266,7 @@ def get_pymongo_index_model(
266
266
fields = []
267
267
for field_name , _ in self .fields_orders :
268
268
field_ = model ._meta .get_field (field_name )
269
- field_path = column_prefix + get_column_path (model , field_name ).column
269
+ field_path = column_prefix + get_column (model , field_name ).column
270
270
mappings = {"path" : field_path }
271
271
if isinstance (field_ , ArrayField ):
272
272
mappings .update (
@@ -292,7 +292,7 @@ def set_name_with_model(self, model):
292
292
"""
293
293
_ , table_name = split_identifier (model ._meta .db_table )
294
294
column_names = [
295
- get_column_path (model , field_name ).column for field_name , order in self .fields_orders
295
+ get_column (model , field_name ).column for field_name , order in self .fields_orders
296
296
]
297
297
column_names_with_order = [
298
298
(f"-{ column_name } " if order else column_name )
0 commit comments