@@ -610,6 +610,7 @@ func (coll *Collection) updateOrReplace(
610
610
multi bool ,
611
611
expectedRr returnResult ,
612
612
checkDollarKey bool ,
613
+ sort interface {},
613
614
args * options.UpdateManyOptions ,
614
615
) (* UpdateResult , error ) {
615
616
@@ -623,6 +624,7 @@ func (coll *Collection) updateOrReplace(
623
624
filter : filter ,
624
625
update : update ,
625
626
hint : args .Hint ,
627
+ sort : sort ,
626
628
arrayFilters : args .ArrayFilters ,
627
629
collation : args .Collation ,
628
630
upsert : args .Upsert ,
@@ -775,7 +777,7 @@ func (coll *Collection) UpdateOne(
775
777
Let : args .Let ,
776
778
}
777
779
778
- return coll .updateOrReplace (ctx , f , update , false , rrOne , true , updateOptions )
780
+ return coll .updateOrReplace (ctx , f , update , false , rrOne , true , args . Sort , updateOptions )
779
781
}
780
782
781
783
// UpdateMany executes an update command to update documents in the collection.
@@ -811,7 +813,7 @@ func (coll *Collection) UpdateMany(
811
813
return nil , fmt .Errorf ("failed to construct options from builder: %w" , err )
812
814
}
813
815
814
- return coll .updateOrReplace (ctx , f , update , true , rrMany , true , args )
816
+ return coll .updateOrReplace (ctx , f , update , true , rrMany , true , nil , args )
815
817
}
816
818
817
819
// ReplaceOne executes an update command to replace at most one document in the collection.
@@ -865,7 +867,7 @@ func (coll *Collection) ReplaceOne(
865
867
Comment : args .Comment ,
866
868
}
867
869
868
- return coll .updateOrReplace (ctx , f , r , false , rrOne , false , updateOptions )
870
+ return coll .updateOrReplace (ctx , f , r , false , rrOne , false , args . Sort , updateOptions )
869
871
}
870
872
871
873
// Aggregate executes an aggregate command against the collection and returns a cursor over the resulting documents.
0 commit comments