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.

Community
  • 1
  • 1
hellectronic
  • 1,390
  • 11
  • 15

1 Answers1

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")

Community
  • 1
  • 1
Scott Hernandez
  • 7,452
  • 2
  • 34
  • 25