See list of all databases in MongoDb, switch database

You are here : Home / MongoDB Tutorial

Contents of page >
  • 1) See list of all databases in MongoDb>
  • 2) You can switch any of above db by using command


1) See list of all databases in MongoDb>
> show dbs

OR

> show databases

OR

> db.getMongo().getDBNames()

Output by executing any of the above command will be like this >
> show dbs
admin   0.078GB
local   0.078GB
mydb    0.078GB
testdb  0.078GB
yourdb  0.078GB
>


2) You can switch any of above db by using command >
use testdb;    It will switch to testdb.  
> use testdb;
switched to db testdb
>



SUMMARY>
So in this mongoDB tutorial we learned how to
1) See list of all databases in MongoDb> show dbs
2) You can switch any of above db by using command in MongoDb>
use testdb;    It will switch to testdb.  


Having any doubt? or you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.



RELATED LINKS>

What is MongoDB - A quick introduction to database


Create new database in mongoDB


Labels: MongoDB
eEdit
Must read for you :