@@ -519,8 +519,20 @@ def delete(self, write_concern=None, _from_doc_delete=False, cascade_refs=None):
519519 write_concern = write_concern , ** {"pull_all__%s" % field_name : self }
520520 )
521521
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+
522530 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+ )
524536
525537 # If we're using an unack'd write concern, we don't really know how
526538 # many items have been deleted at this point, hence we only return
@@ -582,6 +594,15 @@ def update(
582594 update ["$set" ]["_cls" ] = queryset ._document ._class_name
583595 else :
584596 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+
585606 try :
586607 with set_read_write_concern (
587608 queryset ._collection , write_concern , read_concern
@@ -595,6 +616,7 @@ def update(
595616 upsert = upsert ,
596617 array_filters = array_filters ,
597618 session = _get_session (),
619+ ** kwargs ,
598620 )
599621 if full_result :
600622 return result
@@ -1367,8 +1389,18 @@ def aggregate(self, pipeline, **kwargs):
13671389 read_preference = self ._read_preference , read_concern = self ._read_concern
13681390 )
13691391
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+
13701399 return collection .aggregate (
1371- final_pipeline , cursor = {}, session = _get_session (), ** kwargs
1400+ final_pipeline ,
1401+ cursor = {},
1402+ session = _get_session (),
1403+ ** kwargs ,
13721404 )
13731405
13741406 # JS functionality
0 commit comments