Skip to content

Commit feaadd4

Browse files
committed
Document return value for write methods PYTHON-429
1 parent e0c3730 commit feaadd4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pymongo/collection.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ def save(self, to_save, manipulate=True,
248248
- `fsync` (optional): If ``True`` force the database to fsync all
249249
files before returning. When used with `j` the server awaits the
250250
next group commit before returning.
251+
:Returns:
252+
- The ``'_id'`` value of `to_save` or ``[None]`` if `manipulate` is
253+
``False`` and `to_save` has no '_id' field.
251254
252255
.. versionadded:: 1.8
253256
Support for passing `getLastError` options as keyword
@@ -320,6 +323,10 @@ def insert(self, doc_or_docs, manipulate=True,
320323
- `fsync` (optional): If ``True`` force the database to fsync all
321324
files before returning. When used with `j` the server awaits the
322325
next group commit before returning.
326+
:Returns:
327+
- The ``'_id'`` value (or list of '_id' values) of `doc_or_docs` or
328+
``[None]`` if manipulate is ``False`` and the documents passed
329+
as `doc_or_docs` do not include an '_id' field.
323330
324331
.. note:: `continue_on_error` requires server version **>= 1.9.1**
325332
@@ -427,6 +434,9 @@ def update(self, spec, document, upsert=False, manipulate=False,
427434
- `fsync` (optional): If ``True`` force the database to fsync all
428435
files before returning. When used with `j` the server awaits the
429436
next group commit before returning.
437+
:Returns:
438+
- A document (dict) describing the effect of the update or ``None``
439+
if write acknowledgement is disabled.
430440
431441
.. versionadded:: 1.8
432442
Support for passing `getLastError` options as keyword
@@ -521,6 +531,9 @@ def remove(self, spec_or_id=None, safe=None, **kwargs):
521531
- `fsync` (optional): If ``True`` force the database to fsync all
522532
files before returning. When used with `j` the server awaits the
523533
next group commit before returning.
534+
:Returns:
535+
- A document (dict) describing the effect of the remove or ``None``
536+
if write acknowledgement is disabled.
524537
525538
.. versionadded:: 1.8
526539
Support for passing `getLastError` options as keyword arguments.

0 commit comments

Comments
 (0)