MongoDB Create Database
MongoDB does not provide commands to create a database. You can use use dbName
the statement to select a database in the mongo shell. Use the following example:
Syntax:
Limitations
MongoDB database names cannot be empty and must have fewer than 64 characters.
Create Database
First, of all, Use the below command to select the database. To create a new database make sure it does not exist.
You have a database name selected. Now you need to insert at least one document to keep this database. As you have already executed the use command above, all the statements will be executed on the above database.
Show Databases – After inserting the first record the database will be listed in show dbs
command.
Also, You can run db
command to find the current selected database.
0 Comments
CAN FEEDBACK
Emoji