- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 Articles
- 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?
- Why do acids not show acidic behaviour in the absence of water?
- (a) Why do acids not show acidic behaviour in the absence of water?(b) Why does an aqueous solution of an acid conduct electricity?(c) Why does distilled water not conduct electricity whereas rain water does?
- To display a database in the SHOW dbs list, do we need to add collections to it?
- What information does SHOW TABLE DOES display in MySQL
- Why viruses do not show characteristics until they enter the human body?
- Why does HCL gas show its acidic nature only when it dissolves in water?
- Why does my MongoDB group query return always 0 in float conversion? How to fix it?
- Display databases in MongoDB
- Show that cryptarithm $4 times overline{AB}=overline{CAB}$ does not have any solution.
- Why do HCl, HNO3, etc., show acidic characters in aqueous solutions while solutions of compounds like alcohol and glucose do not show acidic character?
- How can I display all databases in MySQL and for each database show all tables?
- Difference between SHOW INDEX, SHOW INDEXES and SHOW KEYS in MySQL?
