@@ -248,22 +248,6 @@ def create_collection(self, name, codec_options=None,
248248 creation. :class:`~pymongo.errors.CollectionInvalid` will be
249249 raised if the collection already exists.
250250
251- Options should be passed as keyword arguments to this method. Supported
252- options vary with MongoDB release. Some examples include:
253-
254- - "size": desired initial size for the collection (in
255- bytes). For capped collections this size is the max
256- size of the collection.
257- - "capped": if True, this is a capped collection
258- - "max": maximum number of objects if capped (optional)
259- - `timeseries`: a document specifying configuration options for
260- timeseries collections
261- - `expireAfterSeconds`: the number of seconds after which a
262- document in a timeseries collection expires
263-
264- See the MongoDB documentation for a full list of supported options by
265- server version.
266-
267251 :Parameters:
268252 - `name`: the name of the collection to create
269253 - `codec_options` (optional): An instance of
@@ -286,7 +270,21 @@ def create_collection(self, name, codec_options=None,
286270 - `session` (optional): a
287271 :class:`~pymongo.client_session.ClientSession`.
288272 - `**kwargs` (optional): additional keyword arguments will
289- be passed as options for the create collection command
273+ be passed as options for the `create collection command`_
274+
275+ All optional `create collection command`_ parameters should be passed
276+ as keyword arguments to this method. Valid options include, but are not
277+ limited to:
278+
279+ - ``size``: desired initial size for the collection (in
280+ bytes). For capped collections this size is the max
281+ size of the collection.
282+ - ``capped``: if True, this is a capped collection
283+ - ``max``: maximum number of objects if capped (optional)
284+ - ``timeseries``: a document specifying configuration options for
285+ timeseries collections
286+ - ``expireAfterSeconds``: the number of seconds after which a
287+ document in a timeseries collection expires
290288
291289 .. versionchanged:: 3.11
292290 This method is now supported inside multi-document transactions
@@ -303,6 +301,9 @@ def create_collection(self, name, codec_options=None,
303301
304302 .. versionchanged:: 2.2
305303 Removed deprecated argument: options
304+
305+ .. _create collection command:
306+ https://docs.mongodb.com/manual/reference/command/create
306307 """
307308 with self .__client ._tmp_session (session ) as s :
308309 # Skip this check in a transaction where listCollections is not
@@ -331,21 +332,6 @@ def aggregate(self, pipeline, session=None, **kwargs):
331332 for operation in cursor:
332333 print(operation)
333334
334- All optional `aggregate command`_ parameters should be passed as
335- keyword arguments to this method. Valid options include, but are not
336- limited to:
337-
338- - `allowDiskUse` (bool): Enables writing to temporary files. When set
339- to True, aggregation stages can write data to the _tmp subdirectory
340- of the --dbpath directory. The default is False.
341- - `maxTimeMS` (int): The maximum amount of time to allow the operation
342- to run in milliseconds.
343- - `batchSize` (int): The maximum number of documents to return per
344- batch. Ignored if the connected mongod or mongos does not support
345- returning aggregate results using a cursor.
346- - `collation` (optional): An instance of
347- :class:`~pymongo.collation.Collation`.
348-
349335 The :meth:`aggregate` method obeys the :attr:`read_preference` of this
350336 :class:`Database`, except when ``$out`` or ``$merge`` are used, in
351337 which case :attr:`~pymongo.read_preferences.ReadPreference.PRIMARY`
@@ -361,7 +347,27 @@ def aggregate(self, pipeline, session=None, **kwargs):
361347 - `pipeline`: a list of aggregation pipeline stages
362348 - `session` (optional): a
363349 :class:`~pymongo.client_session.ClientSession`.
364- - `**kwargs` (optional): See list of options above.
350+ - `**kwargs` (optional): extra `aggregate command`_ parameters.
351+
352+ All optional `aggregate command`_ parameters should be passed as
353+ keyword arguments to this method. Valid options include, but are not
354+ limited to:
355+
356+ - `allowDiskUse` (bool): Enables writing to temporary files. When set
357+ to True, aggregation stages can write data to the _tmp subdirectory
358+ of the --dbpath directory. The default is False.
359+ - `maxTimeMS` (int): The maximum amount of time to allow the operation
360+ to run in milliseconds.
361+ - `batchSize` (int): The maximum number of documents to return per
362+ batch. Ignored if the connected mongod or mongos does not support
363+ returning aggregate results using a cursor.
364+ - `collation` (optional): An instance of
365+ :class:`~pymongo.collation.Collation`.
366+ - `let` (dict): A dict of parameter names and values. Values must be
367+ constant or closed expressions that do not reference document
368+ fields. Parameters can then be accessed as variables in an
369+ aggregate expression context (e.g. ``"$$var"``). This option is
370+ only supported on MongoDB >= 5.0.
365371
366372 :Returns:
367373 A :class:`~pymongo.command_cursor.CommandCursor` over the result
0 commit comments