Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
MongoDB difference between show dbs and show databases?
In MongoDB, there is no functional difference between show dbs and show databases. Both commands are aliases that internally call the same listDatabases command and produce identical output.
Syntax
show dbs
OR
show databases
Example: Using show dbs
show dbs
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
Example: Using show databases
show databases
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
Key Points
- Both commands display all databases accessible to the current user
-
show dbsis the shorter, more commonly used version - Both show database names along with their storage sizes
- Output includes system databases like
admin,config, andlocal
Conclusion
show dbs and show databases are interchangeable commands that list all available databases. Use whichever you prefer ? most MongoDB users favor the shorter show dbs for convenience.
Advertisements
