Skip to content

Commit 99e792b

Browse files
committed
PYTHON-677 - Update docstrings.
1 parent 4704bb8 commit 99e792b

File tree

2 files changed

+88
-65
lines changed

2 files changed

+88
-65
lines changed

pymongo/collection.py

Lines changed: 88 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -241,22 +241,28 @@ def save(self, to_save, manipulate=True, check_keys=True, **kwargs):
241241
- `check_keys` (optional): check if keys start with '$' or
242242
contain '.', raising :class:`~pymongo.errors.InvalidName`
243243
in either case.
244-
- `w` (optional): (integer or string) If this is a replica set, write
245-
operations will block until they have been replicated to the
246-
specified number or tagged set of servers. `w=<int>` always includes
247-
the replica set primary (e.g. w=3 means write to the primary and wait
248-
until replicated to **two** secondaries). **Passing w=0 disables
249-
write acknowledgement and all other write concern options.**
250-
- `wtimeout` (optional): (integer) Used in conjunction with `w`.
251-
Specify a value in milliseconds to control how long to wait for
252-
write propagation to complete. If replication does not complete in
253-
the given timeframe, a timeout exception is raised.
254-
- `j` (optional): If ``True`` block until write operations have been
255-
committed to the journal. Ignored if the server is running without
256-
journaling.
257-
- `fsync` (optional): If ``True`` force the database to fsync all
258-
files before returning. When used with `j` the server awaits the
259-
next group commit before returning.
244+
- `w`: (integer or string) Used with replication, write operations
245+
will block until they have been replicated to the specified number
246+
or tagged set of servers. `w=<integer>` always includes the replica
247+
set primary (e.g. w=3 means write to the primary and wait until
248+
replicated to **two** secondaries). **w=0 disables acknowledgement
249+
of write operations and can not be used with other write concern
250+
options.**
251+
- `wtimeout`: (integer) Used in conjunction with `w`. Specify a value
252+
in milliseconds to control how long to wait for write propagation
253+
to complete. If replication does not complete in the given
254+
timeframe, a timeout exception is raised.
255+
- `j`: If ``True`` block until write operations have been committed
256+
to the journal. Cannot be used in combination with `fsync`. Prior
257+
to MongoDB 2.6 this option was ignored if the server was running
258+
without journaling. Starting with MongoDB 2.6 write operations will
259+
fail with an exception if this option is used when the server is
260+
running without journaling.
261+
- `fsync`: If ``True`` and the server is running without journaling,
262+
blocks until the server has synced all data files to disk. If the
263+
server is running with journaling, this acts the same as the `j`
264+
option, blocking until write operations have been committed to the
265+
journal. Cannot be used in combination with `j`.
260266
:Returns:
261267
- The ``'_id'`` value of `to_save` or ``[None]`` if `manipulate` is
262268
``False`` and `to_save` has no '_id' field.
@@ -317,22 +323,28 @@ def insert(self, doc_or_docs, manipulate=True,
317323
inserts, except lastError will be set if any insert fails, not just
318324
the last one. If multiple errors occur, only the most recent will
319325
be reported by :meth:`~pymongo.database.Database.error`.
320-
- `w` (optional): (integer or string) If this is a replica set, write
321-
operations will block until they have been replicated to the
322-
specified number or tagged set of servers. `w=<int>` always includes
323-
the replica set primary (e.g. w=3 means write to the primary and wait
324-
until replicated to **two** secondaries). **Passing w=0 disables
325-
write acknowledgement and all other write concern options.**
326-
- `wtimeout` (optional): (integer) Used in conjunction with `w`.
327-
Specify a value in milliseconds to control how long to wait for
328-
write propagation to complete. If replication does not complete in
329-
the given timeframe, a timeout exception is raised.
330-
- `j` (optional): If ``True`` block until write operations have been
331-
committed to the journal. Ignored if the server is running without
332-
journaling.
333-
- `fsync` (optional): If ``True`` force the database to fsync all
334-
files before returning. When used with `j` the server awaits the
335-
next group commit before returning.
326+
- `w`: (integer or string) Used with replication, write operations
327+
will block until they have been replicated to the specified number
328+
or tagged set of servers. `w=<integer>` always includes the replica
329+
set primary (e.g. w=3 means write to the primary and wait until
330+
replicated to **two** secondaries). **w=0 disables acknowledgement
331+
of write operations and can not be used with other write concern
332+
options.**
333+
- `wtimeout`: (integer) Used in conjunction with `w`. Specify a value
334+
in milliseconds to control how long to wait for write propagation
335+
to complete. If replication does not complete in the given
336+
timeframe, a timeout exception is raised.
337+
- `j`: If ``True`` block until write operations have been committed
338+
to the journal. Cannot be used in combination with `fsync`. Prior
339+
to MongoDB 2.6 this option was ignored if the server was running
340+
without journaling. Starting with MongoDB 2.6 write operations will
341+
fail with an exception if this option is used when the server is
342+
running without journaling.
343+
- `fsync`: If ``True`` and the server is running without journaling,
344+
blocks until the server has synced all data files to disk. If the
345+
server is running with journaling, this acts the same as the `j`
346+
option, blocking until write operations have been committed to the
347+
journal. Cannot be used in combination with `j`.
336348
:Returns:
337349
- The ``'_id'`` value (or list of '_id' values) of `doc_or_docs` or
338350
``[None]`` if manipulate is ``False`` and the documents passed
@@ -468,22 +480,28 @@ def update(self, spec, document, upsert=False, manipulate=False,
468480
might eventually change to ``True``. It is recommended
469481
that you specify this argument explicitly for all update
470482
operations in order to prepare your code for that change.
471-
- `w` (optional): (integer or string) If this is a replica set, write
472-
operations will block until they have been replicated to the
473-
specified number or tagged set of servers. `w=<int>` always includes
474-
the replica set primary (e.g. w=3 means write to the primary and wait
475-
until replicated to **two** secondaries). **Passing w=0 disables
476-
write acknowledgement and all other write concern options.**
477-
- `wtimeout` (optional): (integer) Used in conjunction with `w`.
478-
Specify a value in milliseconds to control how long to wait for
479-
write propagation to complete. If replication does not complete in
480-
the given timeframe, a timeout exception is raised.
481-
- `j` (optional): If ``True`` block until write operations have been
482-
committed to the journal. Ignored if the server is running without
483-
journaling.
484-
- `fsync` (optional): If ``True`` force the database to fsync all
485-
files before returning. When used with `j` the server awaits the
486-
next group commit before returning.
483+
- `w`: (integer or string) Used with replication, write operations
484+
will block until they have been replicated to the specified number
485+
or tagged set of servers. `w=<integer>` always includes the replica
486+
set primary (e.g. w=3 means write to the primary and wait until
487+
replicated to **two** secondaries). **w=0 disables acknowledgement
488+
of write operations and can not be used with other write concern
489+
options.**
490+
- `wtimeout`: (integer) Used in conjunction with `w`. Specify a value
491+
in milliseconds to control how long to wait for write propagation
492+
to complete. If replication does not complete in the given
493+
timeframe, a timeout exception is raised.
494+
- `j`: If ``True`` block until write operations have been committed
495+
to the journal. Cannot be used in combination with `fsync`. Prior
496+
to MongoDB 2.6 this option was ignored if the server was running
497+
without journaling. Starting with MongoDB 2.6 write operations will
498+
fail with an exception if this option is used when the server is
499+
running without journaling.
500+
- `fsync`: If ``True`` and the server is running without journaling,
501+
blocks until the server has synced all data files to disk. If the
502+
server is running with journaling, this acts the same as the `j`
503+
option, blocking until write operations have been committed to the
504+
journal. Cannot be used in combination with `j`.
487505
:Returns:
488506
- A document (dict) describing the effect of the update or ``None``
489507
if write acknowledgement is disabled.
@@ -599,22 +617,28 @@ def remove(self, spec_or_id=None, multi=True, **kwargs):
599617
- `multi` (optional): If ``True`` (the default) remove all documents
600618
matching `spec_or_id`, otherwise remove only the first matching
601619
document.
602-
- `w` (optional): (integer or string) If this is a replica set, write
603-
operations will block until they have been replicated to the
604-
specified number or tagged set of servers. `w=<int>` always includes
605-
the replica set primary (e.g. w=3 means write to the primary and wait
606-
until replicated to **two** secondaries). **Passing w=0 disables
607-
write acknowledgement and all other write concern options.**
608-
- `wtimeout` (optional): (integer) Used in conjunction with `w`.
609-
Specify a value in milliseconds to control how long to wait for
610-
write propagation to complete. If replication does not complete in
611-
the given timeframe, a timeout exception is raised.
612-
- `j` (optional): If ``True`` block until write operations have been
613-
committed to the journal. Ignored if the server is running without
614-
journaling.
615-
- `fsync` (optional): If ``True`` force the database to fsync all
616-
files before returning. When used with `j` the server awaits the
617-
next group commit before returning.
620+
- `w`: (integer or string) Used with replication, write operations
621+
will block until they have been replicated to the specified number
622+
or tagged set of servers. `w=<integer>` always includes the replica
623+
set primary (e.g. w=3 means write to the primary and wait until
624+
replicated to **two** secondaries). **w=0 disables acknowledgement
625+
of write operations and can not be used with other write concern
626+
options.**
627+
- `wtimeout`: (integer) Used in conjunction with `w`. Specify a value
628+
in milliseconds to control how long to wait for write propagation
629+
to complete. If replication does not complete in the given
630+
timeframe, a timeout exception is raised.
631+
- `j`: If ``True`` block until write operations have been committed
632+
to the journal. Cannot be used in combination with `fsync`. Prior
633+
to MongoDB 2.6 this option was ignored if the server was running
634+
without journaling. Starting with MongoDB 2.6 write operations will
635+
fail with an exception if this option is used when the server is
636+
running without journaling.
637+
- `fsync`: If ``True`` and the server is running without journaling,
638+
blocks until the server has synced all data files to disk. If the
639+
server is running with journaling, this acts the same as the `j`
640+
option, blocking until write operations have been committed to the
641+
journal. Cannot be used in combination with `j`.
618642
:Returns:
619643
- A document (dict) describing the effect of the remove or ``None``
620644
if write acknowledgement is disabled.

pymongo/write_concern.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ def acknowledged(self):
9292
"""
9393
return self.__acknowledged
9494

95-
# This doesn't keep the options in order. Do we care?
9695
def __repr__(self):
9796
return ("WriteConcern(%s)" % (
9897
", ".join("%s=%s" % kvt for kvt in self.document.items()),))

0 commit comments

Comments
 (0)