MongoDB difference between show dbs and show databases?


There is no difference between show dbs and show databases. Both commands internally call listDatabases command.

The show dbs command is as follows −

> show dbs

This will produce the following output −

admin                 0.002GB
app                   0.000GB
business              0.000GB
config                0.000GB
local                 0.000GB
main                  0.000GB
my                    0.001GB
ok                    0.001GB
sample                0.003GB
sampleDemo            0.000GB
studentSearch         0.000GB
test                  0.034GB
university            0.000GB
web                   0.003GB
webcustomertracker    0.000GB

The show databases command is as follows −

> show databases

This will produce the following output −

admin                0.002GB
app                  0.000GB
business             0.000GB
config               0.000GB
local                0.000GB
main                 0.000GB
my                   0.001GB
ok                   0.001GB
sample               0.003GB
sampleDemo           0.000GB
studentSearch        0.000GB
test                 0.034GB
university           0.000GB
web                  0.003GB
webcustomertracker   0.000GB

Updated on: 02-Apr-2020

221 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements