I was trying to create a mongodb (6.1.1) server with mongod
with a custom config, but when I run mongod --config path
the console yields Error parsing command line: Multiple occurrences of option "--config"
.
Running mongod
alone or stuff like mongod --port 12345
seems to create the server, so I'm not sure why it's giving an error parsing the command line. Any path I give (absolute, relative, invalid) it yields the same error. The alias -f
yields the same.
I doubt it matters but I installed mongo through scoop.
Alright found out the issue, it really is because of scoop.
Since one of scoop's objective is to prevent PATH polution, it writes an exe with the same name as the real executable, which runs behind the screen the real executable, with the help of the shim file.
Get-Command mongod
yielded C:\Users\Plancha\scoop\shims\mongod.exe
, and I thought that was the actual mongod
. Turns out it isn't because it's in this shims
folder. I understood this when I tried to copy and run this exe in the desktop (as kinda suggested by one of the commenters), and yielding Could not read shim file
, leading me to make some further research about the package manager.
In conclusion, mongod.shim
was:
path = "C:\Users\Plancha\scoop\apps\mongodb\current\bin\mongod.exe"
args = --config "C:\Users\Plancha\scoop\apps\mongodb\current\bin\mongod.cfg"
,
and the mongod.exe
shim was simply passing the path, those args, and my additional args, leading to the multiple occurrences.
So to fix this, removing the args line was enough. I'll try and write a pull request to the main bucket.