@@ -136,8 +136,8 @@ def drop
136
136
# @option options [ Integer ] :limit The max number of docs to return from the query.
137
137
# @option options [ Integer ] :max_time_ms The maximum amount of time to allow the query
138
138
# to run in milliseconds.
139
- # @option options [ Hash ] :modifiers Meta -operators modifying the output or behavior
140
- # of a query.
139
+ # @option options [ Hash ] :modifiers A document containing meta -operators modifying the
140
+ # output or behavior of a query.
141
141
# @option options [ true, false ] :no_cursor_timeout The server normally times out idle
142
142
# cursors after an inactivity period (10 minutes) to prevent excess memory use.
143
143
# Set this option to prevent that.
@@ -335,17 +335,17 @@ def delete_many(filter = nil)
335
335
# collection.replace_one({ name: 'test' }, { name: 'test1' })
336
336
#
337
337
# @param [ Hash ] filter The filter to use.
338
- # @param [ Hash ] document The document to replace .
339
- # @param [ Hash ] opts The options.
338
+ # @param [ Hash ] replacement The replacement document. .
339
+ # @param [ Hash ] options The options.
340
340
#
341
- # @option opts [ true, false ] :upsert Whether to upsert if the
341
+ # @option options [ true, false ] :upsert Whether to upsert if the
342
342
# document doesn't exist.
343
343
#
344
344
# @return [ Result ] The response from the database.
345
345
#
346
346
# @since 2.1.0
347
- def replace_one ( filter , document , opts = { } )
348
- find ( filter ) . replace_one ( document , opts )
347
+ def replace_one ( filter , replacement , options = { } )
348
+ find ( filter ) . replace_one ( replacement , options )
349
349
end
350
350
351
351
# Update documents in the collection.
@@ -355,16 +355,16 @@ def replace_one(filter, document, opts = {})
355
355
#
356
356
# @param [ Hash ] filter The filter to use.
357
357
# @param [ Hash ] update The update statement.
358
- # @param [ Hash ] opts The options.
358
+ # @param [ Hash ] options The options.
359
359
#
360
- # @option opts [ true, false ] :upsert Whether to upsert if the
360
+ # @option options [ true, false ] :upsert Whether to upsert if the
361
361
# document doesn't exist.
362
362
#
363
363
# @return [ Result ] The response from the database.
364
364
#
365
365
# @since 2.1.0
366
- def update_many ( filter , update , opts = { } )
367
- find ( filter ) . update_many ( update , opts )
366
+ def update_many ( filter , update , options = { } )
367
+ find ( filter ) . update_many ( update , options )
368
368
end
369
369
370
370
# Update a single document in the collection.
@@ -374,16 +374,16 @@ def update_many(filter, update, opts = {})
374
374
#
375
375
# @param [ Hash ] filter The filter to use.
376
376
# @param [ Hash ] update The update statement.
377
- # @param [ Hash ] opts The options.
377
+ # @param [ Hash ] options The options.
378
378
#
379
- # @option opts [ true, false ] :upsert Whether to upsert if the
379
+ # @option options [ true, false ] :upsert Whether to upsert if the
380
380
# document doesn't exist.
381
381
#
382
382
# @return [ Result ] The response from the database.
383
383
#
384
384
# @since 2.1.0
385
- def update_one ( filter , update , opts = { } )
386
- find ( filter ) . update_one ( update , opts )
385
+ def update_one ( filter , update , options = { } )
386
+ find ( filter ) . update_one ( update , options )
387
387
end
388
388
389
389
# Finds a single document in the database via findAndModify and deletes
@@ -393,75 +393,75 @@ def update_one(filter, update, opts = {})
393
393
# collection.find_one_and_delete(name: 'test')
394
394
#
395
395
# @param [ Hash ] filter The filter to use.
396
- # @param [ Hash ] opts The options.
396
+ # @param [ Hash ] options The options.
397
397
#
398
- # @option opts [ Integer ] :max_time_ms The maximum amount of time to allow the command
398
+ # @option options [ Integer ] :max_time_ms The maximum amount of time to allow the command
399
399
# to run in milliseconds.
400
- # @option options [ Hash ] :projection The fields to include or exclude from each doc
401
- # in the result set.
400
+ # @option options [ Hash ] :projection The fields to include or exclude in the returned doc.
402
401
# @option options [ Hash ] :sort The key and direction pairs by which the result set
403
402
# will be sorted.
404
403
#
405
404
# @return [ BSON::Document, nil ] The document, if found.
406
405
#
407
406
# @since 2.1.0
408
- def find_one_and_delete ( filter , opts = { } )
409
- find ( filter , opts ) . find_one_and_delete
407
+ def find_one_and_delete ( filter , options = { } )
408
+ find ( filter , options ) . find_one_and_delete
410
409
end
411
410
412
- # Finds a single document via findAndModify and updates it.
411
+ # Finds a single document via findAndModify and updates it, returning the original doc unless
412
+ # otherwise specified.
413
413
#
414
414
# @example Find a document and update it, returning the original.
415
- # collection.find_one_and_update({ name: 'test' }, { "$set" => { name: 'test1' }}, :return_document => :before)
415
+ # collection.find_one_and_update({ name: 'test' }, { "$set" => { name: 'test1' }})
416
+ #
417
+ # @example Find a document and update it, returning the updated document.
418
+ # collection.find_one_and_update({ name: 'test' }, { "$set" => { name: 'test1' }}, :return_document => :after)
416
419
#
417
420
# @param [ Hash ] filter The filter to use.
418
421
# @param [ BSON::Document ] update The update statement.
419
- # @param [ Hash ] opts The options.
422
+ # @param [ Hash ] options The options.
420
423
#
421
- # @option opts [ Integer ] :max_time_ms The maximum amount of time to allow the command
424
+ # @option options [ Integer ] :max_time_ms The maximum amount of time to allow the command
422
425
# to run in milliseconds.
423
- # @option options [ Hash ] :projection The fields to include or exclude from each doc
424
- # in the result set.
426
+ # @option options [ Hash ] :projection The fields to include or exclude in the returned doc.
425
427
# @option options [ Hash ] :sort The key and direction pairs by which the result set
426
428
# will be sorted.
427
- # @option opts [ Symbol ] :return_document Either :before or :after.
428
- # @option opts [ true, false ] :upsert Whether to upsert if the
429
- # document doesn't exist.
429
+ # @option options [ Symbol ] :return_document Either :before or :after.
430
+ # @option options [ true, false ] :upsert Whether to upsert if the document doesn't exist.
430
431
#
431
432
# @return [ BSON::Document ] The document.
432
433
#
433
434
# @since 2.1.0
434
- def find_one_and_update ( filter , update , opts = { } )
435
- find ( filter , opts ) . find_one_and_update ( update , opts )
435
+ def find_one_and_update ( filter , update , options = { } )
436
+ find ( filter , options ) . find_one_and_update ( update , options )
436
437
end
437
438
438
- # Finds a single document and replaces it.
439
+ # Finds a single document and replaces it, returning the original doc unless
440
+ # otherwise specified.
439
441
#
440
442
# @example Find a document and replace it, returning the original.
441
- # collection.find_one_and_replace({ name: 'test' }, { name: 'test1' }, :return_document => :before )
443
+ # collection.find_one_and_replace({ name: 'test' }, { name: 'test1' })
442
444
#
443
445
# @example Find a document and replace it, returning the new document.
444
446
# collection.find_one_and_replace({ name: 'test' }, { name: 'test1' }, :return_document => :after)
445
447
#
446
448
# @param [ Hash ] filter The filter to use.
447
449
# @param [ BSON::Document ] replacement The replacement document.
448
- # @param [ Hash ] opts The options.
450
+ # @param [ Hash ] options The options.
449
451
#
450
- # @option opts [ Integer ] :max_time_ms The maximum amount of time to allow the command
452
+ # @option options [ Integer ] :max_time_ms The maximum amount of time to allow the command
451
453
# to run in milliseconds.
452
- # @option options [ Hash ] :projection The fields to include or exclude from each doc
453
- # in the result set.
454
+ # @option options [ Hash ] :projection The fields to include or exclude in the returned doc.
454
455
# @option options [ Hash ] :sort The key and direction pairs by which the result set
455
456
# will be sorted.
456
- # @option opts [ Symbol ] :return_document Either :before or :after.
457
- # @option opts [ true, false ] :upsert Whether to upsert if the
458
- # document doesn't exist.
457
+ # @option options [ Symbol ] :return_document Either :before or :after.
458
+ # @option options [ true, false ] :upsert Whether to upsert if the document doesn't exist.
459
459
#
460
460
# @return [ BSON::Document ] The document.
461
461
#
462
462
# @since 2.1.0
463
- def find_one_and_replace ( filter , replacement , opts = { } )
464
- find ( filter , opts ) . find_one_and_update ( replacement , opts )
463
+ def find_one_and_replace ( filter , replacement , options = { } )
464
+ find ( filter , options ) . find_one_and_update ( replacement , options )
465
465
end
466
466
467
467
# Get the fully qualified namespace of the collection.
0 commit comments