@@ -475,26 +475,23 @@ def get_combinator_queries(self):
475
475
if not parts :
476
476
raise EmptyResultSet
477
477
combinator_pipeline = parts .pop (0 )[0 ].get_pipeline ()
478
- if self .query .combinator == "union" :
479
- for part , collection in parts :
480
- combinator_pipeline .append (
481
- {"$unionWith" : {"coll" : collection , "pipeline" : part .get_pipeline ()}}
482
- )
483
- if not self .query .combinator_all :
484
- ids = {}
485
- for alias , expr in main_query_columns :
486
- # Unfold foreign fields.
487
- if isinstance (expr , Col ) and expr .alias != self .collection_name :
488
- ids [self ._unfold_column (expr )] = expr .as_mql (self , self .connection )
489
- else :
490
- ids [alias ] = f"${ alias } "
491
- combinator_pipeline .append ({"$group" : {"_id" : ids }})
492
- projected_fields = self ._fold_columns (ids )
493
- combinator_pipeline .append ({"$addFields" : projected_fields })
494
- if "_id" not in projected_fields :
495
- combinator_pipeline .append ({"$unset" : "_id" })
496
- else :
497
- raise NotSupportedError (f"Combinator { self .query .combinator } isn't supported." )
478
+ for part , collection in parts :
479
+ combinator_pipeline .append (
480
+ {"$unionWith" : {"coll" : collection , "pipeline" : part .get_pipeline ()}}
481
+ )
482
+ if not self .query .combinator_all :
483
+ ids = {}
484
+ for alias , expr in main_query_columns :
485
+ # Unfold foreign fields.
486
+ if isinstance (expr , Col ) and expr .alias != self .collection_name :
487
+ ids [self ._unfold_column (expr )] = expr .as_mql (self , self .connection )
488
+ else :
489
+ ids [alias ] = f"${ alias } "
490
+ combinator_pipeline .append ({"$group" : {"_id" : ids }})
491
+ projected_fields = self ._fold_columns (ids )
492
+ combinator_pipeline .append ({"$addFields" : projected_fields })
493
+ if "_id" not in projected_fields :
494
+ combinator_pipeline .append ({"$unset" : "_id" })
498
495
return combinator_pipeline
499
496
500
497
def get_lookup_pipeline (self ):
0 commit comments