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):
490
490
else :
491
491
combinator_pipeline = inner_pipeline
492
492
if not self .query .combinator_all :
493
- ids = {}
493
+ ids = defaultdict ( dict )
494
494
for alias , expr in main_query_columns :
495
495
# Unfold foreign fields.
496
496
if isinstance (expr , Col ) and expr .alias != self .collection_name :
497
- if expr .alias not in ids :
498
- ids [expr .alias ] = {}
499
497
ids [expr .alias ][expr .target .column ] = expr .as_mql (self , self .connection )
500
498
else :
501
499
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 )
502
503
combinator_pipeline .append ({"$group" : {"_id" : ids }})
503
504
projected_fields = {key : f"$_id.{ key } " for key in ids }
504
505
combinator_pipeline .append ({"$addFields" : projected_fields })
You can’t perform that action at this time.
0 commit comments