3

Is it possible to select a database that MongoDB should use on startup in the mongorc.js?

use dbname

is not functioning. This is a Non-JavaScript macro.

1 Answer 1

5

The db-name is an option when starting the mongo javascript shell.

mongo

mongo --help

You can also do something similar like this from the js file

db = db.getSiblingDB("dbname")

Sign up to request clarification or add additional context in comments.

1 Comment

I know for startup but the second one was important. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.