删除一个数据库

db.dropDatabase()

> show dbs
admin     0.078GB
local     0.078GB
test      0.078GB

> use test
switched to db test

> db.dropDatabase()
{ "dropped" : "test", "ok" : 1 }

删除一个collection(表)

db.表名称.drop()

> show dbs
admin     0.078GB
local     0.078GB
test      0.078GB

> use test
switched to db test

> show collections
system.indexes
user

> db.user.drop()
true

删除符合条件的document(数据)

db.表名称.remove(条件)

> show dbs
admin     0.078GB
local     0.078GB
test      0.078GB

> use test
switched to db test

> show collections
system.indexes
user

> db.user.remove({"name":"admin"})
WriteResult({ "nRemoved" : 1 })