8814be0ab2a07c1996ea32aa4ecef402af38044e
By:
ccuilla

Why mongo shell is "connecting to: test"?

April 16, 2015 9.3k views
MongoDB

Can anyone explain why when I run the mongo shell it is "connecting to: test"?

1 Answer

By default, just running mongo will enter the shell and connect to the "test" database. Typing db into the shell should return test

> db
test

You can switch databases, with the use command:

> use admin
switched to db admin
> db
admin

Checkout the MongoDB docs on getting started with the mongo shell.

  • Thanks. That makes sense. I as thinking it was something else. So Mongo always has a test DB for each server?

  • Yes, Mongo creates the test database by default.

Have another answer? Share your knowledge.