I'm writing JavaScript code for MongoDB shell in client. How can I get the path of the script file which is executing? Please note it's not the value of pwd()
. For example, I'm executing /my_scripts/utils.js
from /my_path
:
> mongodb --nodb /my_scripts/utils.js
so pwd()
returns /my_path
, but how can I get the full path (or relative path to the value of pwd()
) of the current executing file, which is /my_scripts/utils.js
?