Skip to content

Commit d9488a1

Browse files
WaVEVtimgraham
authored andcommitted
prevent $addFields from appearing as defaultdict in query logging
1 parent 552261a commit d9488a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

django_mongodb/compiler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ def _build_aggregation_pipeline(self, ids, group):
193193
projected_fields[table][field] = value
194194
else:
195195
projected_fields[key] = value
196-
pipeline.append({"$addFields": projected_fields})
196+
# Convert defaultdict to dict so it doesn't appear as
197+
# "defaultdict(<CLASS 'dict'>, ..." in query logging.
198+
pipeline.append({"$addFields": dict(projected_fields)})
197199
if "_id" not in projected_fields:
198200
pipeline.append({"$unset": "_id"})
199201
return pipeline

0 commit comments

Comments
 (0)