10/7/2019 - 9:37 AM

Cheat Code - Insert

//The insert() Method
//Here mycol is our collection name, as created in the previous chapter. 
// If the collection doesn't exist in the database, then MongoDB will create this collection and 
//then insert a document into it.
//In the inserted document, if we don't specify the _id parameter, 
//then MongoDB assigns a unique ObjectId for this document.
//_id is 12 bytes hexadecimal number unique for every document in a collection.
//12 bytes are divided as follows −
   _id: ObjectId(7df78ad8902c),
   title: 'MongoDB Overview', 

//insert multiple
      title: 'MongoDB Overview', 
      description: 'MongoDB is no sql database',
      title: 'NoSQL Database', 
      description: "NoSQL database doesn't have tables",
      by: 'tutorials point',
      url: 'http://www.tutorialspoint.com',