db.users.insert( { name: "sue", age: 26, status: "A" } ) The following operation inserts a new document into the users collection. The new document has four fields name , age , and status , and an _id field. MongoDB always adds the _id field to the new document if that field does not exist. MongoDB Documentation, Release 3.0.4 For more information and examples, see db.collection.insert() . Insert Behavior If you add a new document without the _id field, the client library or the mongod instance adds an _id field and populates the field with a unique ObjectId . If you specify the _id field, the value must be unique within the collection. For operations with write concern (page 78), if you try to create a document with a duplicate _id value, mongod returns a duplicate key exception. Other Methods to Add Documents You can also add new documents to a collection using methods that have an upsert (page 76) option. If the option is set to true , these methods will either modify existing documents or add a new document when no matching documents exist for the query. For more information, see Update Behavior with the upsert Option (page 76). In MongoDB, the db.collection.update() method modifies existing documents in a collection . The db.collection.update() method can accept query criteria to determine which documents to update as well as an options document that affects its behavior, such as the multi option to update multiple documents. Operations performed by an update are atomic within a single document. For example, you can safely use the $inc and $mul operators to modify frequently-changed fields in concurrent applications. The following diagram highlights the components of a MongoDB update operation: The following diagram shows the same query in SQL: Update Example db.users.update( { age: { $gt: 18 } }, { $set: { status: "A" } }, { multi: true } ) 75 3.2. MongoDB CRUD Concepts