db.inventory.insert( { item: "ABC1", details: { model: "14Q3", manufacturer: "XYZ Company" }, stock: [ { size: "S", qty: 25 }, { size: "M", qty: 50 } ], category: "clothing" } ) var mydocuments = [ { Define a variable mydocuments that holds an array of documents to insert. MongoDB Documentation, Release 3.0.4 Insert a document into a collection named inventory . The operation will create the collection if the collection does not currently exist. Insert a Document Step 1: Insert a document into a collection. Step 2: Review the inserted document. Insert an Array of Documents The operation returns a WriteResult object with the status of the operation. A successful insert of the document returns the following object: WriteResult({ "nInserted" : 1 }) The nInserted field specifies the number of documents inserted. If the operation encounters an error, the WriteResult object will contain the error information. If the insert operation is successful, verify the insertion by querying the collection. db.inventory.find() The document you inserted should return. { "_id" : ObjectId("53d98f133bb604791249ca99"), "item" : "ABC1", "details" : { "model" : The returned document shows that MongoDB added an _id field to the document. If a client inserts a document that does not contain the _id field, MongoDB adds the field with the value set to a generated ObjectId$^{9}$. The ObjectId 10 values in your documents will differ from the ones shown. You can pass an array of documents to the db.collection.insert() method to insert multiple documents. Step 1: Create an array of documents. $^{9}$https://docs.mongodb.org/manual/reference/object-id $^{10}$https://docs.mongodb.org/manual/reference/object-id 93 3.3. MongoDB CRUD Tutorials