中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

MongoDB 刪除數(shù)據(jù)庫

語法

MongoDB 刪除數(shù)據(jù)庫的語法格式如下:

db.dropDatabase()

刪除當前數(shù)據(jù)庫,默認為 test,你可以使用 db 命令查看當前數(shù)據(jù)庫名。

實例

以下實例我們刪除了數(shù)據(jù)庫 json。

首先,查看所有數(shù)據(jù)庫:

> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
json  0.000GB

接下來我們切換到數(shù)據(jù)庫 json:

> use json
switched to db json
> 

執(zhí)行刪除命令:

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

最后,我們再通過 show dbs 命令數(shù)據(jù)庫是否刪除成功:

> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB

刪除集合

集合刪除語法格式如下:

db.collection.drop()

以下實例刪除了 json 數(shù)據(jù)庫中的集合 site:

> use json
switched to db json
> db.createCollection("json")     # 先創(chuàng)建集合,類似數(shù)據(jù)庫中的表
> show tables             # show collections 命令會更加準確點
json
> db.json.drop()
true
> show tables
>