How to list all databases in the mongo shell?

Solution 1:

Listing all the databases in mongoDB console is using the command show dbs.

For more information on this, refer the Mongo Shell Command Helpers that can be used in the mongo shell.

Solution 2:

For database list:

show databases
show dbs

For table/collection list:

show collections
show tables
db.getCollectionNames()