I've been using mongo and script files like this:
$ mongo getSimilar.js
I would like to pass an argument to the file:
$ mongo getSimilar.js apples
And then in the script file pick up the argument passed in.
var arg = $1;
print(arg);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…