delete mongodb node js using schema code example
Example 1: remove everything from mongodb databaase mongoose
await Challenge.deleteMany({})
await Own.deleteMany({})
await User.deleteMany({})
Example 2: mongoose remove data
Remove is deprecated - use delete
Update for Mongoose v5.5.3 - remove() is now deprecated.
Use deleteOne(), deleteMany() or findOneAndDelete() instead.