CRUD: Documents
Query Documents
In MongoDB, the db.collection.find() method is used to retrieve documents from a collection. This method returns a cursor to the retrieved documents. The db.collection.find() method…
Delete Documents
In MongoDB, the db.colloction.remove() method is used to delete documents from a collection. The remove() method works on two parameters. 1. Deletion criteria: With the…
Update Documents
In MongoDB, update() method is used to update or modify the existing documents of a collection. Syntax: db.COLLECTION_NAME.update(SELECTIOIN_CRITERIA, UPDATED_DATA) Example Consider an example which has a…
Insert Documents
In MongoDB, the db.collection.insert() method is used to add or insert new documents into a collection in your database. Upsert There are also two methods…