File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -589,3 +589,8 @@ def supports_atlas_search(self):
589589 return False
590590 else :
591591 return True
592+
593+ @cached_property
594+ def supports_select_union (self ):
595+ # Stage not supported inside of a multi-document transaction: $unionWith
596+ return not self .supports_transactions
Original file line number Diff line number Diff line change 11from bson import ObjectId
22from django .core .exceptions import ValidationError
3- from django .test import TestCase
3+ from django .test import TestCase , skipUnlessDBFeature
44
55from .models import Order , OrderItem , Tag
66
@@ -75,13 +75,15 @@ def test_filter_parent_by_children_values_obj(self):
7575 parent_qs = Tag .objects .filter (children__id__in = child_ids ).distinct ().order_by ("name" )
7676 self .assertSequenceEqual (parent_qs , [self .t1 ])
7777
78+ @skipUnlessDBFeature ("supports_select_union" )
7879 def test_filter_group_id_union_with_str (self ):
7980 """Combine queries using union with string values."""
8081 qs_a = Tag .objects .filter (group_id = self .group_id_str_1 )
8182 qs_b = Tag .objects .filter (group_id = self .group_id_str_2 )
8283 union_qs = qs_a .union (qs_b ).order_by ("name" )
8384 self .assertSequenceEqual (union_qs , [self .t3 , self .t4 ])
8485
86+ @skipUnlessDBFeature ("supports_select_union" )
8587 def test_filter_group_id_union_with_obj (self ):
8688 """Combine queries using union with ObjectId values."""
8789 qs_a = Tag .objects .filter (group_id = self .group_id_obj_1 )
You can’t perform that action at this time.
0 commit comments