Marshall
My feedback
1 result found
-
1 vote
An error occurred while saving the comment An error occurred while saving the comment Marshall commented
Wernfried:
I'm running with MongoDB 6.0 and mongosh 1.6.0 and this worked for me.
echo "db.getMongo();"|mongosh --quiet "mongodb://user:password@localhost/MHDB?authSource=admin"
MYDB> db.getMongo();
mongodb://<credentials>@localhost/MYDB?authSource=admin&directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.0I can also get it to work as a "here" document. Example:
mongosh --quiet "mongodb://user:password@localhost/MHDB?authSource=admin" <<EOJS
use MYDB
db.getMongo()
EOJSMYDB> db.getMongo();
mongodb://<credentials>@localhost/MYDB?authSource=admin&directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.0Marshall shared this idea ·
Massimillano;
That is more or less what I do now. It's a bit cumbersome since everything is wrapped in bash. I'm not sure how option 2 would work. I'll have to investigate and see how I could make that work.
Everything I'm doing currently has some kind of bash front end that calls some large JS script where parameters are supplied from the command line.
Regards