国产gaysexchina男同gay,japanrcep老熟妇乱子伦视频,吃奶呻吟打开双腿做受动态图,成人色网站,国产av一区二区三区最新精品

MongoDB 創(chuàng)建數(shù)據(jù)庫(kù)

2022-09-07 17:51 更新

語(yǔ)法

MongoDB 創(chuàng)建數(shù)據(jù)庫(kù)的語(yǔ)法格式如下:

use DATABASE_NAME

如果數(shù)據(jù)庫(kù)不存在,則創(chuàng)建數(shù)據(jù)庫(kù),否則切換到指定數(shù)據(jù)庫(kù)。


實(shí)例

以下實(shí)例我們創(chuàng)建了數(shù)據(jù)庫(kù) youj:

> use youj
switched to db youj
> db
youj
> 

如果你想查看所有數(shù)據(jù)庫(kù),可以使用 show dbs 命令:

> show dbs
local  0.078GB
test   0.078GB
> 

可以看到,我們剛創(chuàng)建的數(shù)據(jù)庫(kù) youj 并不在數(shù)據(jù)庫(kù)的列表中, 要顯示它,我們需要向 youj 數(shù)據(jù)庫(kù)插入一些數(shù)據(jù)。

> db.youj.insert({"name":"W3Cschool教程"})
WriteResult({ "nInserted" : 1 })
> show dbs
local   0.078GB
youj  0.078GB
test    0.078GB
> 

MongoDB 中默認(rèn)的數(shù)據(jù)庫(kù)為 test,如果你沒(méi)有創(chuàng)建新的數(shù)據(jù)庫(kù),集合將存放在 test 數(shù)據(jù)庫(kù)中。

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)