Saad Tanvir Logo
Development

Correct use of deleteMany() in MongoDB

Learn how to delete all collections in MongoDB

ST

Saad Tanvir

Updated on Mar 11, 2025

If you are looking to delete all the documents in MongoDB and having an issue then use this code to delete them:

If you got results like

Now you need to check your database, hopefully, the collection is empty.