use help to get access to the frequent commands
help
show all databases
show dbs
use a certain database, use "newdb"
use newdb
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"
db.newcollection.deleteMany({})
用 Compass 导入 json 文件时,文件内容的最外层要有 []
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。