@@ -37,15 +37,21 @@ class Collection
3737 #
3838 # @param [String, Symbol] name the name of the collection.
3939 # @param [DB] db a MongoDB database instance.
40+ #
41+ # @option opts [String, Integer, Symbol] :w (1) Set default number of nodes to which a write
42+ # should be acknowledged
43+ # @option opts [Boolean] :j (false) Set journal acknowledgement
44+ # @option opts [Integer] :wtimeout (false) Set replica set acknowledgement timeout
45+ # @option opts [Boolean] :fsync (false) Set fsync acknowledgement.
46+ #
47+ # Notes about write concern:
48+ # These write concern options will be used for insert, update, and remove methods called on this
49+ # Collection instance. If no value is provided, the default values set on this instance's DB will be used.
50+ # These option values can be overridden for any invocation of insert, update, or remove.
4051 #
4152 # @option opts [:create_pk] :pk (BSON::ObjectId) A primary key factory to use
42- # other than the default BSON::ObjectId.
43- #
44- # @option opts [Hash] :w, :j, :wtimeout, :fsync Set the default write concern
45- # for +insert+, +update+, and +remove+ method called on this Collection instance. If no
46- # value is provided, the default values set on this instance's DB will be used. These option
47- # values can be overridden for any invocation of +insert+, +update+, or +remove+.
48- # @option options [:primary, :secondary] :read The default read preference for queries
53+ # other than the default BSON::ObjectId.
54+ # @option opts [:primary, :secondary] :read The default read preference for queries
4955 # initiates from this connection object. If +:secondary+ is chosen, reads will be sent
5056 # to one of the closest available secondary nodes. If a secondary node cannot be located, the
5157 # read will be sent to the primary. If this option is left unspecified, the value of the read
@@ -326,7 +332,7 @@ def find_one(spec_or_object_id=nil, opts={})
326332 # :fsync will confirm that a write has been fsynced.
327333 # Options provided here will override any write concern options set on this collection,
328334 # its database object, or the current connection. See the options
329- # for + DB#get_last_error+ .
335+ # for DB#get_last_error.
330336 #
331337 # @raise [Mongo::OperationFailure] will be raised iff :w > 0 and the operation fails.
332338 def save ( doc , opts = { } )
@@ -351,14 +357,15 @@ def save(doc, opts={})
351357 # 2nd, a list of invalid documents.
352358 # Return this result format only when :collect_on_error is true.
353359 #
354- # @option opts [Hash] :w, :j, :wtimeout, :fsync Set the write concern for this operation.
355- # :w > 0 will run a +getlasterror+ command on the database to report any assertion.
356- # :j will confirm a write has been committed to the journal,
357- # :wtimeout specifies how long to wait for write confirmation,
358- # :fsync will confirm that a write has been fsynced.
359- # Options provided here will override any write concern options set on this collection,
360- # its database object, or the current connection. See the options
361- # for +DB#get_last_error+.
360+ # @option opts [String, Integer, Symbol] :w (1) Set default number of nodes to which a write
361+ # should be acknowledged
362+ # @option opts [Boolean] :j (false) Set journal acknowledgement
363+ # @option opts [Integer] :wtimeout (false) Set replica set acknowledgement timeout
364+ # @option opts [Boolean] :fsync (false) Set fsync acknowledgement.
365+ #
366+ # Notes on write concern:
367+ # Options provided here will override any write concern options set on this collection,
368+ # its database object, or the current connection. See the options for +DB#get_last_error+.
362369 #
363370 # @option opts [Boolean] :continue_on_error (+false+) If true, then
364371 # continue a bulk insert even if one of the documents inserted
@@ -388,14 +395,15 @@ def insert(doc_or_docs, opts={})
388395 # @param [Hash] selector
389396 # If specified, only matching documents will be removed.
390397 #
391- # @option opts [Hash] :w, :j, :wtimeout, :fsync Set the write concern for this operation.
392- # :w > 0 will run a +getlasterror+ command on the database to report any assertion.
393- # :j will confirm a write has been committed to the journal,
394- # :wtimeout specifies how long to wait for write confirmation,
395- # :fsync will confirm that a write has been fsynced.
396- # Options provided here will override any write concern options set on this collection,
397- # its database object, or the current connection. See the options
398- # for +DB#get_last_error+.
398+ # @option opts [String, Integer, Symbol] :w (1) Set default number of nodes to which a write
399+ # should be acknowledged
400+ # @option opts [Boolean] :j (false) Set journal acknowledgement
401+ # @option opts [Integer] :wtimeout (false) Set replica set acknowledgement timeout
402+ # @option opts [Boolean] :fsync (false) Set fsync acknowledgement.
403+ #
404+ # Notes on write concern:
405+ # Options provided here will override any write concern options set on this collection,
406+ # its database object, or the current connection. See the options for +DB#get_last_error+.
399407 #
400408 # @example remove all documents from the 'users' collection:
401409 # users.remove
@@ -441,14 +449,15 @@ def remove(selector={}, opts={})
441449 # @option opts [Boolean] :upsert (+false+) if true, performs an upsert (update or insert)
442450 # @option opts [Boolean] :multi (+false+) update all documents matching the selector, as opposed to
443451 # just the first matching document. Note: only works in MongoDB 1.1.3 or later.
444- # @option opts [Hash] :w, :j, :wtimeout, :fsync Set the write concern for this operation.
445- # :w > 0 will run a +getlasterror+ command on the database to report any assertion.
446- # :j will confirm a write has been committed to the journal,
447- # :wtimeout specifies how long to wait for write confirmation,
448- # :fsync will confirm that a write has been fsynced.
449- # Options provided here will override any write concern options set on this collection,
450- # its database object, or the current connection. See the options
451- # for +DB#get_last_error+.
452+ # @option opts [String, Integer, Symbol] :w (1) Set default number of nodes to which a write
453+ # should be acknowledged
454+ # @option opts [Boolean] :j (false) Set journal acknowledgement
455+ # @option opts [Integer] :wtimeout (false) Set replica set acknowledgement timeout
456+ # @option opts [Boolean] :fsync (false) Set fsync acknowledgement.
457+ #
458+ # Notes on write concern:
459+ # Options provided here will override any write concern options set on this collection,
460+ # its database object, or the current connection. See the options for DB#get_last_error.
452461 #
453462 # @return [Hash, true] Returns a Hash containing the last error object if acknowledging writes.
454463 # Otherwise, returns true.
0 commit comments