File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -490,15 +490,16 @@ def get_combinator_queries(self):
490490 else :
491491 combinator_pipeline = inner_pipeline
492492 if not self .query .combinator_all :
493- ids = {}
493+ ids = defaultdict ( dict )
494494 for alias , expr in main_query_columns :
495495 # Unfold foreign fields.
496496 if isinstance (expr , Col ) and expr .alias != self .collection_name :
497- if expr .alias not in ids :
498- ids [expr .alias ] = {}
499497 ids [expr .alias ][expr .target .column ] = expr .as_mql (self , self .connection )
500498 else :
501499 ids [alias ] = f"${ alias } "
500+ # Convert defaultdict to dict so it doesn't appear as
501+ # "defaultdict(<CLASS 'dict'>, ..." in query logging.
502+ ids = dict (ids )
502503 combinator_pipeline .append ({"$group" : {"_id" : ids }})
503504 projected_fields = {key : f"$_id.{ key } " for key in ids }
504505 combinator_pipeline .append ({"$addFields" : projected_fields })
You can’t perform that action at this time.
0 commit comments