Why mongo shell is "connecting to: test"?

April 16, 2015 15.6k views

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

You can switch databases, with the use command:

> use admin
switched to db admin
> db

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.