Is there any way to update whole Entity in MongoDB?

java, mongodb

Solution

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

Problem

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.. P.S. Code written in Java.

Original source