File tree Expand file tree Collapse file tree 1 file changed +2
-20
lines changed Expand file tree Collapse file tree 1 file changed +2
-20
lines changed Original file line number Diff line number Diff line change @@ -614,26 +614,8 @@ def execute_sql(self, result_type):
614
614
if is_empty :
615
615
rows = 0
616
616
else :
617
- base_pipeline = [
618
- {"$match" : criteria },
619
- {"$set" : dict (values )},
620
- ]
621
- count_pipeline = [* base_pipeline , {"$count" : "count" }]
622
- pipeline = [
623
- * base_pipeline ,
624
- {
625
- "$merge" : {
626
- "into" : self .collection_name ,
627
- "whenMatched" : "replace" ,
628
- "whenNotMatched" : "discard" ,
629
- }
630
- },
631
- ]
632
- with self .connection .connection .start_session () as session , session .start_transaction ():
633
- result = next (self .collection .aggregate (count_pipeline ), {"count" : 0 })
634
- self .collection .aggregate (pipeline )
635
- rows = result ["count" ]
636
- # rows = 0 if is_empty else self.update(values)
617
+ rows = self .collection .update_many (criteria , [{"$set" : dict (values )}]).matched_count
618
+
637
619
for query in self .query .get_related_updates ():
638
620
aux_rows = query .get_compiler (self .using ).execute_sql (result_type )
639
621
if is_empty and aux_rows :
You can’t perform that action at this time.
0 commit comments