Command summary (discussed as follows):
- db.<collection>.deleteOne({<filter>});
- db.<collection>.deleteMany({<filter>});
As you can see from the command summary, the main focus of delete*() commands is the filter. You use the same syntax as you would when executing find(). Because the delete*() commands can potentially delete all data from a collection if you make a mistake in the filter, it is recommended you use deleteOne() whenever possible.
In this example we delete a customer with the name C. T. Russell:
Before you execute deleteMany(), first run find() to see if the filter you're using yields the correct ...