Mongoengine - how to atomically update a dictionary? -


i have model looks this:

class testdoc(document):     name = stringfield()     friends = listfield(stringfield())     address_book = dictfield() 

and wish atomically update address_book field whenever friends list changes. how can modify both fields in atomic operation? can't find modifier in documentation:

https://mongoengine-odm.readthedocs.org/en/latest/guide/querying.html#atomic-updates

that makes atomic update dictionaries. thanks!

when every $push or $pull friends field in same update have modify address_book eg:

testdoc(name="sue", friends=["bob", "sarah"],          address_book={"bob": "1 farm", "sarah": "owl house"}).save()  testdoc.objects(name="sue").update(pull__friends="bob",                                     unset__address_book__bob=1) 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -