update Archive
16 Jun 2014
mongoDB – Upserts – insert or update a document

If we use update command the document is updated only if that document record is present in collection. But if the requirement is that if document is present then we update it otherwise insert it as a new record. Then we can use upsert command. Suppose we run an update command as follows > db.users.update({"name":"mike"},{$set:{$age:
10 Jan 2014
MongoDB – Insert, Update, Delete and Read

MongoDB stores data in form of documents are JSON like key – value pairs.