File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -434,13 +434,16 @@ def project_field(column):
434
434
)
435
435
436
436
@cached_property
437
- def collection_name (self ):
438
- base_table = next (
437
+ def base_table (self ):
438
+ return next (
439
439
v
440
440
for k , v in self .query .alias_map .items ()
441
441
if isinstance (v , BaseTable ) and self .query .alias_refcount [k ]
442
442
)
443
- return base_table .table_alias or base_table .table_name
443
+
444
+ @cached_property
445
+ def collection_name (self ):
446
+ return self .base_table .table_alias or self .base_table .table_name
444
447
445
448
@cached_property
446
449
def collection (self ):
@@ -469,6 +472,7 @@ def get_combinator_queries(self):
469
472
)
470
473
)
471
474
compiler_ .pre_sql_setup ()
475
+ compiler_ .column_indices = self .column_indices
472
476
columns = compiler_ .get_columns ()
473
477
parts .append ((compiler_ .build_query (columns ), compiler_ , columns ))
474
478
except EmptyResultSet :
@@ -496,7 +500,12 @@ def get_combinator_queries(self):
496
500
# Combine query with the current combinator pipeline.
497
501
if combinator_pipeline :
498
502
combinator_pipeline .append (
499
- {"$unionWith" : {"coll" : compiler_ .collection_name , "pipeline" : inner_pipeline }}
503
+ {
504
+ "$unionWith" : {
505
+ "coll" : compiler_ .base_table .table_name ,
506
+ "pipeline" : inner_pipeline ,
507
+ }
508
+ }
500
509
)
501
510
else :
502
511
combinator_pipeline = inner_pipeline
You can’t perform that action at this time.
0 commit comments