Docs Home → Start with Guides
In this guide, you will delete data from MongoDB.
Time required: 10 minutes
Switch to the database and collection you wish to query. In
this case you will be using the
sample_guides database and
The following example illustrates using a query filter to delete
documents where their
orbitalPeriod is greater than 5 and less
result contains some information about the delete
operation. To verify you deleted documents, print the amount of
documents the driver deleted.
Here is the complete code followed by sample output.
If you have completed this guide, you have deleted data from MongoDB.
That completes this introduction to CRUD operations in MongoDB.
See the following resources for more in-depth information about the concepts presented here:
Build a Dynamic Index
Retrieve documents in MongoDB with full-text search.