use help to get access to the frequent commands
代码语言:javascript复制help
show all databases
代码语言:javascript复制show dbs
use a certain database, use "newdb"
代码语言:javascript复制use newdb
Delete
Delete All Documents¶
To remove all documents from a collection, pass an empty filter document
{}
to either thedb.collection.deleteMany()
or thedb.collection.remove()
method.
https://docs.mongodb.com/v3.2/tutorial/remove-documents/#delete-all-documents
DeprecationWarning: Collection.remove() is deprecated. Use deleteOne, deleteMany, findOneAndDelete, or bulkWrite.
eg. Delete all documents in "newcollection"
代码语言:javascript复制db.newcollection.deleteMany({})
用 Compass 导入 json 文件时,文件内容的最外层要有 []