Fix ReturnDocument examples.
This commit is contained in:
parent
d69f76d380
commit
c60a4cd84b
@ -47,8 +47,8 @@
|
||||
.. automethod:: find(filter=None, projection=None, skip=0, limit=0, no_cursor_timeout=False, cursor_type=CursorType.NON_TAILABLE, sort=None, allow_partial_results=False, oplog_replay=False, modifiers=None, manipulate=True)
|
||||
.. automethod:: find_one(filter_or_id=None, *args, **kwargs)
|
||||
.. automethod:: find_one_and_delete
|
||||
.. automethod:: find_one_and_replace(filter, replacement, projection=None, sort=None, return_document=ReturnDocument.Before, **kwargs)
|
||||
.. automethod:: find_one_and_update(filter, update, projection=None, sort=None, return_document=ReturnDocument.Before, **kwargs)
|
||||
.. automethod:: find_one_and_replace(filter, replacement, projection=None, sort=None, return_document=ReturnDocument.BEFORE, **kwargs)
|
||||
.. automethod:: find_one_and_update(filter, update, projection=None, sort=None, return_document=ReturnDocument.BEFORE, **kwargs)
|
||||
.. automethod:: count
|
||||
.. automethod:: distinct
|
||||
.. automethod:: create_index
|
||||
|
||||
@ -1814,7 +1814,7 @@ class Collection(common.BaseObject):
|
||||
>>> db.example.find_one_and_update(
|
||||
... {'_id': 'userid'},
|
||||
... {'$inc': {'seq': 1}},
|
||||
... return_document=ReturnDocument.After)
|
||||
... return_document=ReturnDocument.AFTER)
|
||||
{u'_id': u'userid', u'seq': 1}
|
||||
|
||||
You can limit the fields returned with the *projection* option.
|
||||
@ -1823,7 +1823,7 @@ class Collection(common.BaseObject):
|
||||
... {'_id': 'userid'},
|
||||
... {'$inc': {'seq': 1}},
|
||||
... projection={'seq': True, '_id': False},
|
||||
... return_document=ReturnDocument.After)
|
||||
... return_document=ReturnDocument.AFTER)
|
||||
{u'seq': 2}
|
||||
|
||||
The *upsert* option can be used to create the document if it doesn't
|
||||
@ -1836,7 +1836,7 @@ class Collection(common.BaseObject):
|
||||
... {'$inc': {'seq': 1}},
|
||||
... projection={'seq': True, '_id': False},
|
||||
... upsert=True,
|
||||
... return_document=ReturnDocument.After)
|
||||
... return_document=ReturnDocument.AFTER)
|
||||
{u'seq': 1}
|
||||
|
||||
If multiple documents match *filter*, a *sort* can be applied.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user