I want to pass the environment variable named file_path
to js file.
I am using the following syntax:
mongo --eval "var file_path='$file_path'" < aggregation.js
Output:
MongoDB shell version: 3.2.9-rc0
connecting to: test
Note:
It does not execute aggregation.js
file.
only it pass the argument.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…