Frage

I started mongodb by the command

mongod --dbpath ./data/

My app is able to save and retrieve data from the mongodb with the above server but when I go to mongo console from other terinal tab using

$ mongo 
MongoDB shell version: 2.6.0
connecting to: test
> show collections
> 

it doesn't show any collections. Is the mongodb connecting to another database? How do I connect to my db

War es hilfreich?

Lösung

Use the command:

use <database name>

where you replace <database name> with the name of your database that you want to connect to

Andere Tipps

You may use the following command to show all databases:

show dbs
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top