I'm using Spring Data MongoDB and currently I'm wondering if there's any way to update whole entity like mongoTemplate.update(entityObject)? Because the usual way is to update properties one-by-one.. PS Code written in Java.
You can use the save() method on the entity.
http://www.mongodb.org/display/DOCS/Updating#Updating-%7B%7Bsave%28%29%7D%7Dinthemongoshell
http://www.mongodb.org/display/DOCS/Java+-+Saving+Objects+Using+DBObject
Right - the save() method does a full document replace. Because the database is schema-less, the concept of fields doesn't really exist apart from your document.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.