Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongodb : why show dbs does not show my databases?

Tags:

mongodb

I have setup mongodb 64bits on Windows. I ran server and client successfully.

But when I type:

show dbs

Output is

local  0.000GB

Why ? show dbs is supposed to list all databases at least the default one "test" am I wrong ?

like image 646
user310291 Avatar asked Aug 02 '16 16:08

user310291


People also ask

How do I view databases in MongoDB?

If you want to check your databases list, use the command show dbs. Your created database (mydb) is not present in list. To display database, you need to insert at least one document into it. In MongoDB default database is test.

How do I create a collection in MongoDB?

In MongoDB, you don't need to create collection. MongoDB creates collection automatically, when you insert some document.


1 Answers

Although you may be in the test database by default, the database does not actually get created until you insert a document into a collection in the database which will implicitly create the collection and the database.

like image 195
helmy Avatar answered Oct 13 '22 00:10

helmy