drop collection mongodb code example
Example 1: drop mongo database
// First show what databases have you gotten
show dbs
// then, use the database name that you want to drop
use YOUR_DATABASE_NAME
// now you can drop it
db.dropDatabase()
// show collections should be empty now
show collections
Example 2: mongodb drop db
db.dropDatabase()
Example 3: drop a collection in mongodb
db.mycollection.drop()
Example 4: mongodb remove all from collection
db.collection.remove({})
Example 5: delete collection mongodb
db.collection.drop()