I want to pass the environment variable named file_path to js file.
file_path
I am using the following syntax:
mongo --eval \"var file_path=\'$fil
Looks like Native Method shellGetEnv() has been added meanwhile, see MongoDB GitHub
shellGetEnv()
So, would be simple
shellGetEnv("file_path")
However, the method is not documented and it looks it is not accessible from Mongo shell. Perhaps it becomes available in future releases.