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):
589
589
return False
590
590
else :
591
591
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 1
1
from bson import ObjectId
2
2
from django .core .exceptions import ValidationError
3
- from django .test import TestCase
3
+ from django .test import TestCase , skipUnlessDBFeature
4
4
5
5
from .models import Order , OrderItem , Tag
6
6
@@ -75,13 +75,15 @@ def test_filter_parent_by_children_values_obj(self):
75
75
parent_qs = Tag .objects .filter (children__id__in = child_ids ).distinct ().order_by ("name" )
76
76
self .assertSequenceEqual (parent_qs , [self .t1 ])
77
77
78
+ @skipUnlessDBFeature ("supports_select_union" )
78
79
def test_filter_group_id_union_with_str (self ):
79
80
"""Combine queries using union with string values."""
80
81
qs_a = Tag .objects .filter (group_id = self .group_id_str_1 )
81
82
qs_b = Tag .objects .filter (group_id = self .group_id_str_2 )
82
83
union_qs = qs_a .union (qs_b ).order_by ("name" )
83
84
self .assertSequenceEqual (union_qs , [self .t3 , self .t4 ])
84
85
86
+ @skipUnlessDBFeature ("supports_select_union" )
85
87
def test_filter_group_id_union_with_obj (self ):
86
88
"""Combine queries using union with ObjectId values."""
87
89
qs_a = Tag .objects .filter (group_id = self .group_id_obj_1 )
You can’t perform that action at this time.
0 commit comments