@@ -389,6 +389,11 @@ def delete_one(opts = {})
389
389
# @option opts [ true, false ] :upsert Whether to upsert if the
390
390
# document doesn't exist.
391
391
# Can be :w => Integer, :fsync => Boolean, :j => Boolean.
392
+ # @option opts [ Hash ] :sort Specifies which document the operation
393
+ # replaces if the query matches multiple documents. The first document
394
+ # matched by the sort order will be replaced.
395
+ # This option is only supported by servers >= 8.0. Older servers will
396
+ # report an error for using this option.
392
397
#
393
398
# @return [ Result ] The response from the database.
394
399
#
@@ -410,6 +415,7 @@ def replace_one(replacement, opts = {})
410
415
Operation ::U => replacement ,
411
416
hint : opts [ :hint ] ,
412
417
collation : opts [ :collation ] || opts [ 'collation' ] || collation ,
418
+ sort : opts [ :sort ] || opts [ 'sort' ] ,
413
419
} . compact
414
420
if opts [ :upsert ]
415
421
update_doc [ 'upsert' ] = true
@@ -549,6 +555,11 @@ def update_many(spec, opts = {})
549
555
# document doesn't exist.
550
556
# @option opts [ Hash ] :write_concern The write concern options.
551
557
# Can be :w => Integer, :fsync => Boolean, :j => Boolean.
558
+ # @option opts [ Hash ] :sort Specifies which document the operation
559
+ # updates if the query matches multiple documents. The first document
560
+ # matched by the sort order will be updated.
561
+ # This option is only supported by servers >= 8.0. Older servers will
562
+ # report an error for using this option.
552
563
#
553
564
# @return [ Result ] The response from the database.
554
565
#
@@ -570,6 +581,7 @@ def update_one(spec, opts = {})
570
581
Operation ::U => spec ,
571
582
hint : opts [ :hint ] ,
572
583
collation : opts [ :collation ] || opts [ 'collation' ] || collation ,
584
+ sort : opts [ :sort ] || opts [ 'sort' ] ,
573
585
} . compact
574
586
if opts [ :upsert ]
575
587
update_doc [ 'upsert' ] = true
0 commit comments