Domanda

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

È stato utile?

Soluzione

Use the command:

use <database name>

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

Altri suggerimenti

You may use the following command to show all databases:

show dbs
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top