

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why SHOW DBS does not show my databases in MongoDB?
This SHOW DBS command won’t show the databases because you may have not created a document for a collection. If you will create document for a collection then the created database will be visible.
Let us implement the above concept and create a database −
> use web; switched to db web
Following is the query to show all databases −
> show dbs;
This will produce the following output −
admin 0.001GB config 0.000GB local 0.000GB my 0.001GB sample 0.001GB sampleDemo 0.000GB studentSearch 0.000GB test 0.010GB university 0.000GB
Above, the WEB database is not visible since we haven’t created a collection in the same database.
In order to display WEB database, we need to create a collection with documents in the same database as shown below −
> db.check.insertOne({"ClientName":"John"}); { "acknowledged" : true, "insertedId" : ObjectId("5cb806c2623186894665ae35") }
Following is the query to display all documents from the collection with the help of find() method −
> db.check.find();
This will produce the following output −
{ "_id" : ObjectId("5cb806c2623186894665ae35"), "ClientName" : "John" }
Let us execute the above command to display all databases −
> show dbs;
This will produce the following output −
admin 0.001GB config 0.000GB local 0.000GB my 0.001GB sample 0.001GB sampleDemo 0.000GB studentSearch 0.000GB test 0.010GB university 0.000GB web 0.000GB
Look at the above sample output, WEB database is now visible.
- Related Questions & Answers
- MongoDB difference between show dbs and show databases?
- What is the BSON query for the command 'show dbs' (list of databases) in MongoDB?
- Does MongoDB getUsers() and SHOW command fulfil the same purpose?
- What information does SHOW TABLE DOES display in MySQL
- Difference between SHOW INDEX, SHOW INDEXES and SHOW KEYS in MySQL?
- To display a database in the SHOW dbs list, do we need to add collections to it?
- What does 'show processlist' command do in MySQL?
- Show Bootstrap class
- Command to show the database currently being used in MongoDB?
- Only show tables with certain patterns in MySQL “show tables”?
- How can I display all databases in MySQL and for each database show all tables?
- Python - Show which entries in a Pandas Index are not NA
- Show content with Bootstrap
- jQuery Effect show() Method
- Why does my MongoDB group query return always 0 in float conversion? How to fix it?