Add the command-line option --configExpand exec
to the mongod
command.
It is then possible to expand an environment variable by using __exec:
and
bash. Here are a few lines from the file mongod.conf file where I used this method.
processManagement:
fork: true
pidFilePath:
__exec: "bash -c 'echo -n $XDG_RUNTIME_DIR/mongodb/mongod.pid'"
type: string
The Mongodb version on the computer is 4.4.5.
[user@laptop ~]$ mongod --version | grep version | tail -1
"version": "4.4.5",
[user@laptop ~]$
Update: The computer is running Linux. I just realized that the question was about Windows 7. Maybe it's possible to do something similar on Windows 7. I guess you would then need to replace bash
with something else.