2014-03-12 50 views
3

当我开始蒙戈客户mongo.exe,它打印出以下错误:的`.mongorc.js`没有找到,但有一个

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. 
> 

正如你看到的,我的用户路径是C:\User\Zoltán和字符á被读取为未知字符。我敢打赌,这是问题所在,为什么mongo无法找到我的.mongorc.js

有什么办法可以明确地设置路径为.mongorc.js。也许有一个配置文件?

回答

1

还没有。未来版本将会有“全球”mongorc。现在你可以在“假的”,例如:

mongo --norc --shell fake.js 

所以你告诉shell忽略找.mongorc.js那么你在JavaScript文件传递,就像你,如果你想运行的内容。

--shell参数强制在对file(“fake.js”)进行评估后返回“shell”。

因此,只需在该文件中添加任何有效的JavaScript,它将被视为标准.mongorc.js中的条目。

+0

'mongo --norc'忽略了这个文件,你很好走。 – Keon

2

mongo --norc忽略该文件,你很好去。

0

我收到以下错误:

2017-10-02T12:54:21.435-0500 I STORAGE In File::open(), CreateFileW for 'H:\.mongorc.js' failed with errno:3 The system cannot find the path specified.

我创建的目录/data/db我正在错误的位置下,它解决了问题。

H:\>md data 

H:\>cd data 

H:\data>md db 

一旦创建了这些目录,我就能够无任何问题地连接。

H:\data>mongo 
MongoDB shell version: 3.0.15 
connecting to: test 
> db.names.insert({'name':'Mahrukh Khan'}); 
WriteResult({ "nInserted" : 1 }) 
>