Skip to content

Commit b9fb789

Browse files
committed
RUBY-1627 Document collection insert options (#2587)
* RUBY-1627 Document collection insert options * RUBY-1627 add comment option * RUBY-1627 fix wording * RUBY-1627 use pipe instead of comma * RUBY-1627 alphabetize the options
1 parent f5fd06a commit b9fb789

File tree

1 file changed

+38
-24
lines changed

1 file changed

+38
-24
lines changed

lib/mongo/collection.rb

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Collection
8383
#
8484
# @param [ Object ] other The object to check.
8585
#
86-
# @return [ true, false ] If the objects are equal.
86+
# @return [ true | false ] If the objects are equal.
8787
#
8888
# @since 2.0.0
8989
def ==(other)
@@ -297,7 +297,7 @@ def with(new_options)
297297
# @example Is the collection capped?
298298
# collection.capped?
299299
#
300-
# @return [ true, false ] If the collection is capped.
300+
# @return [ true | false ] If the collection is capped.
301301
#
302302
# @since 2.0.0
303303
def capped?
@@ -409,8 +409,10 @@ def create(opts = {})
409409
#
410410
# @param [ Hash ] opts The options for the drop operation.
411411
#
412-
# @option options [ Session ] :session The session to use for the operation.
412+
# @option opts [ Session ] :session The session to use for the operation.
413413
# @option opts [ Hash ] :write_concern The write concern options.
414+
# @option opts [ Hash | nil ] :encrypted_fields Encrypted fields hash that
415+
# was provided to `create` collection helper.
414416
#
415417
# @return [ Result ] The result of the command.
416418
#
@@ -447,27 +449,27 @@ def drop(opts = {})
447449
# @param [ Hash ] filter The filter to use in the find.
448450
# @param [ Hash ] options The options for the find.
449451
#
450-
# @option options [ true, false ] :allow_disk_use When set to true, the
452+
# @option options [ true | false ] :allow_disk_use When set to true, the
451453
# server can write temporary data to disk while executing the find
452454
# operation. This option is only available on MongoDB server versions
453455
# 4.4 and newer.
454-
# @option options [ true, false ] :allow_partial_results Allows the query to get partial
456+
# @option options [ true | false ] :allow_partial_results Allows the query to get partial
455457
# results if some shards are down.
456458
# @option options [ Integer ] :batch_size The number of documents returned in each batch
457459
# of results from MongoDB.
458460
# @option options [ Hash ] :collation The collation to use.
459-
# @option options [ Object ] :comment A user-provided
460-
# comment to attach to this command.
461+
# @option options [ Object ] :comment A user-provided comment to attach to
462+
# this command.
461463
# @option options [ :tailable, :tailable_await ] :cursor_type The type of cursor to use.
462464
# @option options [ Integer ] :limit The max number of docs to return from the query.
463465
# @option options [ Integer ] :max_time_ms
464466
# The maximum amount of time to allow the query to run, in milliseconds.
465467
# @option options [ Hash ] :modifiers A document containing meta-operators modifying the
466468
# output or behavior of a query.
467-
# @option options [ true, false ] :no_cursor_timeout The server normally times out idle
469+
# @option options [ true | false ] :no_cursor_timeout The server normally times out idle
468470
# cursors after an inactivity period (10 minutes) to prevent excess memory use.
469471
# Set this option to prevent that.
470-
# @option options [ true, false ] :oplog_replay For internal replication
472+
# @option options [ true | false ] :oplog_replay For internal replication
471473
# use only, applications should not set this option.
472474
# @option options [ Hash ] :projection The fields to include or exclude from each doc
473475
# in the result set.
@@ -493,11 +495,11 @@ def find(filter = nil, options = {})
493495
# @param [ Array<Hash> ] pipeline The aggregation pipeline.
494496
# @param [ Hash ] options The aggregation options.
495497
#
496-
# @option options [ true, false ] :allow_disk_use Set to true if disk
498+
# @option options [ true | false ] :allow_disk_use Set to true if disk
497499
# usage is allowed during the aggregation.
498500
# @option options [ Integer ] :batch_size The number of documents to return
499501
# per batch.
500-
# @option options [ true, false ] :bypass_document_validation Whether or
502+
# @option options [ true | false ] :bypass_document_validation Whether or
501503
# not to skip document level validation.
502504
# @option options [ Hash ] :collation The collation to use.
503505
# @option options [ Object ] :comment A user-provided
@@ -507,7 +509,7 @@ def find(filter = nil, options = {})
507509
# See the server documentation for details.
508510
# @option options [ Integer ] :max_time_ms The maximum amount of time in
509511
# milliseconds to allow the aggregation to run.
510-
# @option options [ true, false ] :use_cursor Indicates whether the command
512+
# @option options [ true | false ] :use_cursor Indicates whether the command
511513
# will request that the server provide results using a cursor. Note that
512514
# as of server version 3.6, aggregations always provide results using a
513515
# cursor and this option is therefore not valid.
@@ -733,7 +735,13 @@ def inspect
733735
# @param [ Hash ] document The document to insert.
734736
# @param [ Hash ] opts The insert options.
735737
#
738+
# @option opts [ true | false ] :bypass_document_validation Whether or
739+
# not to skip document level validation.
740+
# @option opts [ Object ] :comment A user-provided comment to attach to
741+
# this command.
736742
# @option opts [ Session ] :session The session to use for the operation.
743+
# @option opts [ Hash ] :write_concern The write concern options.
744+
# Can be :w => Integer, :fsync => Boolean, :j => Boolean.
737745
#
738746
# @return [ Result ] The database response wrapper.
739747
#
@@ -778,9 +786,15 @@ def insert_one(document, opts = {})
778786
# @param [ Array<Hash> ] documents The documents to insert.
779787
# @param [ Hash ] options The insert options.
780788
#
789+
# @option options [ true | false ] :bypass_document_validation Whether or
790+
# not to skip document level validation.
791+
# @option options [ Object ] :comment A user-provided comment to attach to
792+
# this command.
781793
# @option options [ true | false ] :ordered Whether the operations
782794
# should be executed in order.
783795
# @option options [ Session ] :session The session to use for the operation.
796+
# @option options [ Hash ] :write_concern The write concern options.
797+
# Can be :w => Integer, :fsync => Boolean, :j => Boolean.
784798
#
785799
# @return [ Result ] The database response wrapper.
786800
#
@@ -800,11 +814,11 @@ def insert_many(documents, options = {})
800814
# @param [ Array<Hash> ] requests The bulk write requests.
801815
# @param [ Hash ] options The options.
802816
#
803-
# @option options [ true, false ] :ordered Whether the operations
817+
# @option options [ true | false ] :ordered Whether the operations
804818
# should be executed in order.
805819
# @option options [ Hash ] :write_concern The write concern options.
806820
# Can be :w => Integer, :fsync => Boolean, :j => Boolean.
807-
# @option options [ true, false ] :bypass_document_validation Whether or
821+
# @option options [ true | false ] :bypass_document_validation Whether or
808822
# not to skip document level validation.
809823
# @option options [ Session ] :session The session to use for the set of operations.
810824
# @option options [ Hash ] :let Mapping of variables to use in the command.
@@ -893,9 +907,9 @@ def parallel_scan(cursor_count, options = {})
893907
# @param [ Hash ] replacement The replacement document..
894908
# @param [ Hash ] options The options.
895909
#
896-
# @option options [ true, false ] :upsert Whether to upsert if the
910+
# @option options [ true | false ] :upsert Whether to upsert if the
897911
# document doesn't exist.
898-
# @option options [ true, false ] :bypass_document_validation Whether or
912+
# @option options [ true | false ] :bypass_document_validation Whether or
899913
# not to skip document level validation.
900914
# @option options [ Hash ] :collation The collation to use.
901915
# @option options [ Session ] :session The session to use.
@@ -920,9 +934,9 @@ def replace_one(filter, replacement, options = {})
920934
# @param [ Hash | Array<Hash> ] update The update document or pipeline.
921935
# @param [ Hash ] options The options.
922936
#
923-
# @option options [ true, false ] :upsert Whether to upsert if the
937+
# @option options [ true | false ] :upsert Whether to upsert if the
924938
# document doesn't exist.
925-
# @option options [ true, false ] :bypass_document_validation Whether or
939+
# @option options [ true | false ] :bypass_document_validation Whether or
926940
# not to skip document level validation.
927941
# @option options [ Hash ] :collation The collation to use.
928942
# @option options [ Array ] :array_filters A set of filters specifying to which array elements
@@ -949,9 +963,9 @@ def update_many(filter, update, options = {})
949963
# @param [ Hash | Array<Hash> ] update The update document or pipeline.
950964
# @param [ Hash ] options The options.
951965
#
952-
# @option options [ true, false ] :upsert Whether to upsert if the
966+
# @option options [ true | false ] :upsert Whether to upsert if the
953967
# document doesn't exist.
954-
# @option options [ true, false ] :bypass_document_validation Whether or
968+
# @option options [ true | false ] :bypass_document_validation Whether or
955969
# not to skip document level validation.
956970
# @option options [ Hash ] :collation The collation to use.
957971
# @option options [ Array ] :array_filters A set of filters specifying to which array elements
@@ -1018,8 +1032,8 @@ def find_one_and_delete(filter, options = {})
10181032
# @option options [ Hash ] :sort The key and direction pairs by which the result set
10191033
# will be sorted.
10201034
# @option options [ Symbol ] :return_document Either :before or :after.
1021-
# @option options [ true, false ] :upsert Whether to upsert if the document doesn't exist.
1022-
# @option options [ true, false ] :bypass_document_validation Whether or
1035+
# @option options [ true | false ] :upsert Whether to upsert if the document doesn't exist.
1036+
# @option options [ true | false ] :bypass_document_validation Whether or
10231037
# not to skip document level validation.
10241038
# @option options [ Hash ] :write_concern The write concern options.
10251039
# Defaults to the collection's write concern.
@@ -1058,8 +1072,8 @@ def find_one_and_update(filter, update, options = {})
10581072
# @option options [ Hash ] :sort The key and direction pairs by which the result set
10591073
# will be sorted.
10601074
# @option options [ Symbol ] :return_document Either :before or :after.
1061-
# @option options [ true, false ] :upsert Whether to upsert if the document doesn't exist.
1062-
# @option options [ true, false ] :bypass_document_validation Whether or
1075+
# @option options [ true | false ] :upsert Whether to upsert if the document doesn't exist.
1076+
# @option options [ true | false ] :bypass_document_validation Whether or
10631077
# not to skip document level validation.
10641078
# @option options [ Hash ] :write_concern The write concern options.
10651079
# Defaults to the collection's write concern.

0 commit comments

Comments
 (0)