Is there a way to access shell env variable in the mongo shell?
In nodejs, it can access an environment variable in script like following.
var uri = process.env['MONGOLAB_URI']
I am looking for the same way in mongo script.
Is there a way to access shell env variable in the mongo shell?
In nodejs, it can access an environment variable in script like following.
var uri = process.env['MONGOLAB_URI']
I am looking for the same way in mongo script.
You can use a redirection like this :
NAME="John"
mongo << EOF
use testDB
db.person.findOne({"name":"$NAME"})
EOF