March 2018
Beginner to intermediate
308 pages
8h 23m
English
MongoDB provides the following methods to remove documents from the collection:
The db.collection.deleteMany() method is used to delete all the documents that match the given criteria. If you want to delete all the documents, you can pass an empty document criterion:

This query will delete all the documents contained in the user_profiles collection.
To delete the single most document which matched the given criteria, we use the db.collection.deleteOne() method. The following query deletes the record where the userId is equal to 1:
The following methods can also ...
Read now
Unlock full access