Create Database in MongoDB


Using ‘Use’ keyword we can create database in MongoDB, for example see following command. 

>use myMongoDB

Command will create new database if “myMongoDB” does not exist otherwise it will return the existing database.
To check your currently selected database use the command db

>db
myMongoDB

If you want to check your databases list, then use the command show dbs.

>show dbs
Local 0.78987GB
myMongoDB 0.98978GB

1 comment:

PostgreSQL-Query: Sort result set by specific field values using ORDER BY Clause

Problem: Suppose we have a book_inventory table which has some columns such as id, isbn, title, author, publisher, publish_date, etc.. whe...