-
Notifications
You must be signed in to change notification settings - Fork 5
Update
Namlook edited this page Aug 21, 2011
·
1 revision
Updating document work the same way as pymongo. Just use the update
method do a collection.
>>> connection.tutorial.blogposts.update({"title": "Hello World"}, {"$set":{"title": "Hello World"}})
The good thing with MongoLite is you once you have specify the database and collection name in __database__
and __collection__
, you don't have to write it again:
>>> connection.BlogPost.collection.update({"title": "Hello World"}, {"$set":{"title": "Hello World"}})
So, if you change __collection__
into the BlogPost
object, all your code will be up to date.
Please see the pymongo's documentation for more details about updating document.