Select specific database in mongorc.js
-
29-05-2021 - |
Pregunta
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.
Solución
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")
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow