Skip to content

Commit bee1f41

Browse files
WaVEVtimgraham
authored andcommitted
Avoid project field collision.
1 parent d8a32d4 commit bee1f41

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

django_mongodb/compiler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ def get_project_fields(self, columns=None, ordering=None):
490490
fields[alias] = 1
491491

492492
for column, _ in ordering or []:
493-
if column not in fields:
493+
foreign_table = column.split(".", 1)[0] if "." in column else None
494+
if column not in fields and foreign_table not in fields:
494495
fields[column] = 1
495496

496497
return fields

0 commit comments

Comments
 (0)