Create Database in MongoDB


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

>use myMongoDB

Command will create a 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 database list, then use the command "show dbs".

>show dbs
Local 0.78987GB
myMongoDB 0.98978GB

1 comment:

Please do not enter any spam link in the comment box.

Related Posts

Fatal Error: Peer authentication failed for user "postgres", when trying to get pgsql working with rails.

Problem: Sometimes, we get the following error when trying to make a connection in Rails.  FATAL ERROR: Peer authentication failed for us...