@@ -100,19 +100,59 @@ def ==(other)
100100 # @param [ String, Symbol ] name The collection name.
101101 # @param [ Hash ] options The collection options.
102102 #
103- # @option options [ Hash ] :write Deprecated. Equivalent to :write_concern
103+ # @option opts [ true | false ] :capped Create a fixed-sized collection.
104+ # @option opts [ Hash ] :change_stream_pre_and_post_images Used to enable
105+ # pre- and post-images on the created collection.
106+ # The hash may have the following items:
107+ # - *:enabled* -- true or false.
108+ # @option opts [ Hash ] :clustered_index Create a clustered index.
109+ # This option specifies how this collection should be clustered on _id.
110+ # The hash may have the following items:
111+ # - *:key* -- The clustered index key field. Must be set to { _id: 1 }.
112+ # - *:unique* -- Must be set to true. The collection will not accept
113+ # inserted or updated documents where the clustered index key value
114+ # matches an existing value in the index.
115+ # - *:name* -- Optional. A name that uniquely identifies the clustered index.
116+ # @option opts [ Hash ] :collation The collation to use.
117+ # @option opts [ Hash ] :encrypted_fields Hash describing encrypted fields
118+ # for queryable encryption.
119+ # @option opts [ Integer ] :expire_after Number indicating
120+ # after how many seconds old time-series data should be deleted.
121+ # @option opts [ Integer ] :max The maximum number of documents in a
122+ # capped collection. The size limit takes precedents over max.
123+ # @option opts [ Array<Hash> ] :pipeline An array of pipeline stages.
124+ # A view will be created by applying this pipeline to the view_on
125+ # collection or view.
126+ # @option options [ Hash ] :read_concern The read concern options hash,
127+ # with the following optional keys:
128+ # - *:level* -- the read preference level as a symbol; valid values
129+ # are *:local*, *:majority*, and *:snapshot*
130+ # @option options [ Hash ] :read The read preference options.
131+ # The hash may have the following items:
132+ # - *:mode* -- read preference specified as a symbol; valid values are
133+ # *:primary*, *:primary_preferred*, *:secondary*, *:secondary_preferred*
134+ # and *:nearest*.
135+ # - *:tag_sets* -- an array of hashes.
136+ # - *:local_threshold*.
137+ # @option opts [ Session ] :session The session to use for the operation.
138+ # @option opts [ Integer ] :size The size of the capped collection.
139+ # @option opts [ Hash ] :time_series Create a time-series collection.
140+ # The hash may have the following items:
141+ # - *:timeField* -- The name of the field which contains the date in each
142+ # time series document.
143+ # - *:metaField* -- The name of the field which contains metadata in each
144+ # time series document.
145+ # - *:granularity* -- Set the granularity to the value that is the closest
146+ # match to the time span between consecutive incoming measurements.
147+ # Possible values are "seconds" (default), "minutes", and "hours".
148+ # @option opts [ Hash ] :validator Hash describing document validation
149+ # options for the collection.
150+ # @option opts [ String ] :view_on The name of the source collection or
151+ # view from which to create a view.
152+ # @option opts [ Hash ] :write Deprecated. Equivalent to :write_concern
104153 # option.
105- # @option options [ Hash ] :write_concern The write concern options.
154+ # @option opts [ Hash ] :write_concern The write concern options.
106155 # Can be :w => Integer|String, :fsync => Boolean, :j => Boolean.
107- # @option options [ Hash ] :time_series Create a time-series collection.
108- # See https://mongodb.com/docs/manual/core/timeseries-collections/ for more
109- # information about time-series collection.
110- # @option options [ Integer ] :expire_after Number indicating
111- # after how many seconds old time-series data should be deleted.
112- # @options clustered_index [ Hash ] :clustered_index Create a clustered index.
113- # This option specifies how this collection should be clustered on _id.
114- # See https://www.mongodb.com/docs/v5.3/reference/method/db.createCollection/#std-label-db.createCollection.clusteredIndex
115- # for more information about this option.
116156 #
117157 # @since 2.0.0
118158 def initialize ( database , name , options = { } )
@@ -204,17 +244,37 @@ def write_concern_with_session(session)
204244 wc
205245 end
206246
207- # Provides a new collection with either a new read preference or new write concern
208- # merged over the existing read preference / write concern.
247+ # Provides a new collection with either a new read preference, new read
248+ # concern or new write concern merged over the existing read preference /
249+ # read concern / write concern.
209250 #
210251 # @example Get a collection with a changed read preference.
211252 # collection.with(read: { mode: :primary_preferred })
253+
254+ # @example Get a collection with a changed read concern.
255+ # collection.with(read_concern: { level: :majority })
212256 #
213257 # @example Get a collection with a changed write concern.
214258 # collection.with(write_concern: { w: 3 })
215-
259+ #
216260 # @param [ Hash ] new_options The new options to use.
217261 #
262+ # @option new_options [ Hash ] :read The read preference options.
263+ # The hash may have the following items:
264+ # - *:mode* -- read preference specified as a symbol; valid values are
265+ # *:primary*, *:primary_preferred*, *:secondary*, *:secondary_preferred*
266+ # and *:nearest*.
267+ # - *:tag_sets* -- an array of hashes.
268+ # - *:local_threshold*.
269+ # @option new_options [ Hash ] :read_concern The read concern options hash,
270+ # with the following optional keys:
271+ # - *:level* -- the read preference level as a symbol; valid values
272+ # are *:local*, *:majority*, and *:snapshot*
273+ # @option new_options [ Hash ] :write Deprecated. Equivalent to :write_concern
274+ # option.
275+ # @option new_options [ Hash ] :write_concern The write concern options.
276+ # Can be :w => Integer|String, :fsync => Boolean, :j => Boolean.
277+ #
218278 # @return [ Mongo::Collection ] A new collection instance.
219279 #
220280 # @since 2.1.0
@@ -251,17 +311,48 @@ def capped?
251311 #
252312 # @param [ Hash ] opts The options for the create operation.
253313 #
254- # @option opts [ Session ] :session The session to use for the operation.
255- # @option opts [ Hash ] :write_concern The write concern options.
256- # @option opts [ Hash ] :time_series Create a time-series collection.
257- # @option opts [ Integer ] :expire_after Number indicating
258- # after how many seconds old time-series data should be deleted.
314+ # @option opts [ true | false ] :capped Create a fixed-sized collection.
259315 # @option opts [ Hash ] :change_stream_pre_and_post_images Used to enable
260316 # pre- and post-images on the created collection.
317+ # The hash may have the following items:
318+ # - *:enabled* -- true or false.
319+ # @option opts [ Hash ] :clustered_index Create a clustered index.
320+ # This option specifies how this collection should be clustered on _id.
321+ # The hash may have the following items:
322+ # - *:key* -- The clustered index key field. Must be set to { _id: 1 }.
323+ # - *:unique* -- Must be set to true. The collection will not accept
324+ # inserted or updated documents where the clustered index key value
325+ # matches an existing value in the index.
326+ # - *:name* -- Optional. A name that uniquely identifies the clustered index.
327+ # @option opts [ Hash ] :collation The collation to use.
261328 # @option opts [ Hash ] :encrypted_fields Hash describing encrypted fields
262329 # for queryable encryption.
330+ # @option opts [ Integer ] :expire_after Number indicating
331+ # after how many seconds old time-series data should be deleted.
332+ # @option opts [ Integer ] :max The maximum number of documents in a
333+ # capped collection. The size limit takes precedents over max.
334+ # @option opts [ Array<Hash> ] :pipeline An array of pipeline stages.
335+ # A view will be created by applying this pipeline to the view_on
336+ # collection or view.
337+ # @option opts [ Session ] :session The session to use for the operation.
338+ # @option opts [ Integer ] :size The size of the capped collection.
339+ # @option opts [ Hash ] :time_series Create a time-series collection.
340+ # The hash may have the following items:
341+ # - *:timeField* -- The name of the field which contains the date in each
342+ # time series document.
343+ # - *:metaField* -- The name of the field which contains metadata in each
344+ # time series document.
345+ # - *:granularity* -- Set the granularity to the value that is the closest
346+ # match to the time span between consecutive incoming measurements.
347+ # Possible values are "seconds" (default), "minutes", and "hours".
263348 # @option opts [ Hash ] :validator Hash describing document validation
264349 # options for the collection.
350+ # @option opts [ String ] :view_on The name of the source collection or
351+ # view from which to create a view.
352+ # @option opts [ Hash ] :write Deprecated. Equivalent to :write_concern
353+ # option.
354+ # @option opts [ Hash ] :write_concern The write concern options.
355+ # Can be :w => Integer|String, :fsync => Boolean, :j => Boolean.
265356 #
266357 # @return [ Result ] The result of the command.
267358 #
0 commit comments