File tree Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -685,6 +685,7 @@ def execute_sql(self, returning_fields=None):
685
685
@wrap_database_errors
686
686
def insert (self , docs , returning_fields = None ):
687
687
"""Store a list of documents using field columns as element names."""
688
+ self .connection .validate_no_broken_transaction ()
688
689
inserted_ids = self .collection .insert_many (
689
690
docs , session = self .connection .session
690
691
).inserted_ids
@@ -770,6 +771,7 @@ def execute_sql(self, result_type):
770
771
771
772
@wrap_database_errors
772
773
def update (self , criteria , pipeline ):
774
+ self .connection .validate_no_broken_transaction ()
773
775
return self .collection .update_many (
774
776
criteria , pipeline , session = self .connection .session
775
777
).matched_count
Original file line number Diff line number Diff line change @@ -84,8 +84,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
84
84
# Value.as_mql() doesn't call output_field.get_db_prep_save():
85
85
# https://github.com/mongodb/django-mongodb-backend/issues/282
86
86
"model_fields.test_jsonfield.TestSaveLoad.test_bulk_update_custom_get_prep_value" ,
87
- # to debug
88
- "transactions.tests.AtomicMiscTests.test_mark_for_rollback_on_error_in_transaction" ,
89
87
}
90
88
# $bitAnd, #bitOr, and $bitXor are new in MongoDB 6.3.
91
89
_django_test_expected_failures_bitwise = {
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ def __repr__(self):
61
61
@wrap_database_errors
62
62
def delete (self ):
63
63
"""Execute a delete query."""
64
+ self .compiler .connection .validate_no_broken_transaction ()
64
65
if self .compiler .subqueries :
65
66
raise NotSupportedError ("Cannot use QuerySet.delete() when a subquery is required." )
66
67
return self .compiler .collection .delete_many (
@@ -73,6 +74,7 @@ def get_cursor(self):
73
74
Return a pymongo CommandCursor that can be iterated on to give the
74
75
results of the query.
75
76
"""
77
+ self .compiler .connection .validate_no_broken_transaction ()
76
78
return self .compiler .collection .aggregate (
77
79
self .get_pipeline (), session = self .compiler .connection .session
78
80
)
You can’t perform that action at this time.
0 commit comments