CRUD operations Create, Read, Update, Delete documents or data.




Create / Insert Operation

Create or insert operations add new documents to a collection. The insert method uses the insert command internally, which is provided by MongoDB.

db.products.insert( { _id: 10, item: "box", qty: 20 } )



Read Operation

Read operation retrieve documents from a collection.

db.product.find( { _id: 5 } )



Update Operation

Update operation modify the existing documents in the collection. For updating any specific documents, a new criterion can be incorporated with the update statement, which will only update the selected documents.

db.product.update( { _id: 1},{ $inc: { qty: 10} } )



Delete Operation

Delete operations remove documents from a collection.