創建數據庫
更新時間 2023-11-29 21:18:37
最近更新時間: 2023-11-29 21:18:37
分享文章
本頁介紹了如何使用shell命令創建數據庫。
通過shell命令創建數據庫
操作步驟
- 通過shell連接至實例,請參見文檔數據庫服務-快速入門-連接文檔型數據庫服務實例教程。
- 輸入創建數據庫命令。
> use testdb //testdb 為創建數據庫的名稱
switched to db testdb
- 插入數據。
> db.a.insert({"key":"value"})
WriteResult({ "nInserted" : 1 })
- 查看collection。
> db.getCollectionNames()
[ "a" ]
- 查看數據庫。
> show dbs
admin ? 0.000GB
config 0.000GB
local ? 0.000GB
testdb 0.000GB