@@ -519,8 +519,20 @@ def delete(self, write_concern=None, _from_doc_delete=False, cascade_refs=None):
519
519
write_concern = write_concern , ** {"pull_all__%s" % field_name : self }
520
520
)
521
521
522
+ kwargs = {}
523
+ if self ._hint not in (- 1 , None ):
524
+ kwargs ["hint" ] = self ._hint
525
+ if self ._collation :
526
+ kwargs ["collation" ] = self ._collation
527
+ if self ._comment :
528
+ kwargs ["comment" ] = self ._comment
529
+
522
530
with set_write_concern (queryset ._collection , write_concern ) as collection :
523
- result = collection .delete_many (queryset ._query , session = _get_session ())
531
+ result = collection .delete_many (
532
+ queryset ._query ,
533
+ session = _get_session (),
534
+ ** kwargs ,
535
+ )
524
536
525
537
# If we're using an unack'd write concern, we don't really know how
526
538
# many items have been deleted at this point, hence we only return
@@ -582,6 +594,15 @@ def update(
582
594
update ["$set" ]["_cls" ] = queryset ._document ._class_name
583
595
else :
584
596
update ["$set" ] = {"_cls" : queryset ._document ._class_name }
597
+
598
+ kwargs = {}
599
+ if self ._hint not in (- 1 , None ):
600
+ kwargs ["hint" ] = self ._hint
601
+ if self ._collation :
602
+ kwargs ["collation" ] = self ._collation
603
+ if self ._comment :
604
+ kwargs ["comment" ] = self ._comment
605
+
585
606
try :
586
607
with set_read_write_concern (
587
608
queryset ._collection , write_concern , read_concern
@@ -595,6 +616,7 @@ def update(
595
616
upsert = upsert ,
596
617
array_filters = array_filters ,
597
618
session = _get_session (),
619
+ ** kwargs ,
598
620
)
599
621
if full_result :
600
622
return result
@@ -1367,8 +1389,18 @@ def aggregate(self, pipeline, **kwargs):
1367
1389
read_preference = self ._read_preference , read_concern = self ._read_concern
1368
1390
)
1369
1391
1392
+ if self ._hint not in (- 1 , None ):
1393
+ kwargs .setdefault ("hint" , self ._hint )
1394
+ if self ._collation :
1395
+ kwargs .setdefault ("collation" , self ._collation )
1396
+ if self ._comment :
1397
+ kwargs .setdefault ("comment" , self ._comment )
1398
+
1370
1399
return collection .aggregate (
1371
- final_pipeline , cursor = {}, session = _get_session (), ** kwargs
1400
+ final_pipeline ,
1401
+ cursor = {},
1402
+ session = _get_session (),
1403
+ ** kwargs ,
1372
1404
)
1373
1405
1374
1406
# JS functionality
0 commit comments