add docs for positional push operator #1565
This commit is contained in:
parent
7782aa7379
commit
fb00b79d19
@ -565,6 +565,15 @@ cannot use the `$` syntax in keyword arguments it has been mapped to `S`::
|
|||||||
>>> post.tags
|
>>> post.tags
|
||||||
['database', 'mongodb']
|
['database', 'mongodb']
|
||||||
|
|
||||||
|
From MongoDB version 2.6, push operator supports $position value which allows
|
||||||
|
to push values with index.
|
||||||
|
>>> post = BlogPost(title="Test", tags=["mongo"])
|
||||||
|
>>> post.save()
|
||||||
|
>>> post.update(push__tags__0=["database", "code"])
|
||||||
|
>>> post.reload()
|
||||||
|
>>> post.tags
|
||||||
|
['database', 'code', 'mongo']
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
Currently only top level lists are handled, future versions of mongodb /
|
Currently only top level lists are handled, future versions of mongodb /
|
||||||
pymongo plan to support nested positional operators. See `The $ positional
|
pymongo plan to support nested positional operators. See `The $ positional
|
||||||
|
Loading…
x
Reference in New Issue
Block a user