MongoDB: Show Database
In our previous tutorial, we have created a database called books.
In MongoDB, a database is composed of collections and a collection is composed of documents.
We first start MongoDB.
If you are using a Mac, open your terminal and start the Mongo Daemon first.
$ mongod
Next, open a new terminal and start the Mongo Shell.
$ mongo
This will open up the Mongo Shell from where you can input your commands.
But if you system runs on Windows, navigate to the /bin directory and double-click on the Mongo Daemon mongod.exe. Next, in the same /bin directory, double-click on mongo.exe. This will start the Mongo Shell for command inputs.
Now there already exist some default databases in MongoDB, like admin, config and local . When you list all the databases, they will show along with the database/databases you created. The below commands
$ show databases
or
$ show dbs
will list all the databases along with the admin, config and local default databases.