Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB not creating database in shell

Tags:

mongodb

I'm using a book to learn MongoDB. It says that in order to create a db in Mongo, I just need to 'use' it.

show dbs
admin 0.000GB
local 0.000GB

When I do, use someDBName

It says switched to db someDBName

But when I do show dbs

I just see admin and local again. I don't see the someDBName database.

like image 417
Human Cyborg Relations Avatar asked Dec 12 '16 12:12

Human Cyborg Relations


1 Answers

It will not show until your database is empty. To have your database shown you can use

create collection command to insert collection then it will be shown to you by using

show dbs
like image 141
Simran Avatar answered Sep 30 '22 23:09

Simran