Drop Collection
MongoDB 的 db.collection.drop() 用于从数据库中删除集合。
首先,检查可用的集合到你的数据库 mydb。
> use mydb
switched to db mydb
> show collections
newCollection1
newCollection2
newCollection3
system.indexes
现在删除名为 newCollection1 的集合。
> db.newCollection1.drop()
true
注意: 如果集合成功下载,则该方法将返回 true,否则将返回 false。
再次检查集合列表到数据库中。
> show collections
newCollection2
newCollection3
system.indexes
参考: MongoDB drop() 方法。