mongoose delete All code example
Example 1: remove everything from mongodb databaase mongoose
await Challenge.deleteMany({})
await Own.deleteMany({})
await User.deleteMany({})
Example 2: delete document mongose
Model.deleteOne({ options }, function (err) {});
Example 3: clean collection mongoose
await Model.deleteMany();
Example 4: delete document mongoose
Tank.deleteOne({ size: 'large' }, function (err) {
if (err) return handleError(err);
// deleted at most one tank document
});