File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 68
68
run : >
69
69
python3 django_repo/tests/runtests.py --settings mongodb_settings -v 2
70
70
annotations.tests.NonAggregateAnnotationTestCase.test_basic_annotation
71
+ annotations.tests.NonAggregateAnnotationTestCase.test_basic_f_annotation
71
72
auth_tests.test_models.UserManagerTestCase
72
73
backends.base.test_base.DatabaseWrapperTests
73
74
basic
Original file line number Diff line number Diff line change @@ -88,10 +88,14 @@ def get_cursor(self):
88
88
fields = {}
89
89
for name , expr in self .columns or []:
90
90
try :
91
- fields [ expr .target .column ] = 1
91
+ column = expr .target .column
92
92
except AttributeError :
93
93
# Generate the MQL for an annotation.
94
94
fields [name ] = expr .as_mql_agg (self .compiler , self .connection )
95
+ else :
96
+ # If name != column, then this is an annotatation referencing
97
+ # another column.
98
+ fields [name ] = 1 if name == column else f"${ column } "
95
99
pipeline = []
96
100
if self .mongo_query :
97
101
pipeline .append ({"$match" : self .mongo_query })
You can’t perform that action at this time.
0 commit comments