When I start the mongo client mongo.exe
, it prints out the following error:
MongoDB shell version: 2.4.9
connecting to: test
Wed Mar 12 11:15:47.013 In File::open(), CreateFileW for 'C:\Users\Zolt�n\.mongo
rc.js' failed with errno:3 The system cannot find the path specified.
Wed Mar 12 11:15:47.014 In File::len(), GetFileSizeEx for 'C:\Users\Zolt�n\.mong
orc.js' failed with errno:6 The handle is invalid.
Wed Mar 12 11:15:47.015 In File::read(), SetFilePointerEx for 'C:\Users\Zolt�n\.
mongorc.js' tried to set the file pointer to 0 but failed with errno:6 The handl
e is invalid.
>
As you see, my user path is C:\User\Zoltán
and the character á
is read as an unknown character. I bet this is the problem, why mongo
can't find my .mongorc.js
.
Is there any way I can explicitly set the path for .mongorc.js
. Maybe with a configuration file?
mongo --norc
ignores the file, and you're good to go.
Not yet there isn't. There will be a "global" mongorc in future versions. For now you can "fake it" like so:
mongo --norc --shell fake.js
So you tell the shell to ignore looking for .mongorc.js
then you pass in a javascript file just like you would if you wanted to run the contents.
The --shell
parameter forces the return to "shell" after the file
("fake.js") has been evaluated.
So just put any valid JavaScript in that file and it will be treated like the entries in the standard .mongorc.js
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With