Document Database Service

Creating a database

2025-07-16 03:15:50

Creating a Database Using the Shell Command

Procedure

1. Connect to the instance using the shell command. For more information, see the tutorial in DDS - Getting Started - Connecting to DDS Instance.

2. Enter the database creation command.

> use testdb //testdb is the name of the database you created
switched to db testdb

3. Insert data.

> db.a.insert({"key":"value"})
WriteResult({ "nInserted" : 1 })

4. Check collection.

> db.getCollectionNames()
[ "a" ]

5. Check the database.

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


i0yPWBkAsrpw