How to drop or delete a collection in MongoDB?

前端 未结 2 1247
一向
一向 2021-02-03 17:47

What is the best way to drop a collection in MongoDB?

I am using the following:

db.collection.drop()

As described in the manual:

<
2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-03 17:47

    To drop a collection 'users' of database 'mydb':

    $ use mydb
    $ db.users.drop()
    

提交回复
热议问题