MongoDB Delete Document
Use db.colloction.remove() method to delete any document from MongoDB collection on basis of critaria.
Syntax:
Delete Matching Document
Now use the following command to delete a specific document from MongoDB collection with user_name = rahul.
The above command will remove all documents having user_name rahul. To remove only the first matching document from the collection use the following command.
Delete All Documents in Collection
Use the following command with no deletion criteria to delete all documents from the specific collection. For example, below will delete all documents from user's collections.
0 Comments
CAN FEEDBACK
Emoji