سؤال

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

هل كانت مفيدة؟

المحلول

Use the command:

use <database name>

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

نصائح أخرى

You may use the following command to show all databases:

show dbs
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top