MongoDB中textSearchEnable = true出错

时间:2014-01-14 11:25:59

标签: mongodb

在mongodb中启用文本搜索时出现以下错误。任何建议。

我有mongo.config filw,其中包含:

##store data here
dbpath=C:\mongodb\data

##all output go here
logpath=C:\mongodb\log\mongo.log

##log read and write operations
diaglog=3

错误是:

C:\mongodb-win32-x86_64-2.4.6\bin>mongod --setParameter textSearchEnabled=true
Tue Jan 14 16:52:51.336 [initandlisten] MongoDB starting : pid=976 port=27017 dbpath=\data\db\ 64-bit host=dellvostro3
Tue Jan 14 16:52:51.337 [initandlisten] db version v2.4.6
Tue Jan 14 16:52:51.337 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
Tue Jan 14 16:52:51.337 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack
 1') BOOST_LIB_VERSION=1_49
Tue Jan 14 16:52:51.337 [initandlisten] allocator: system
Tue Jan 14 16:52:51.337 [initandlisten] options: { setParameter: [ "textSearchEnabled=true" ] }
Tue Jan 14 16:52:51.337 [initandlisten] exception in initAndListen: 10296
*********************************************************************
 ERROR: dbpath (\data\db\) does not exist.
 Create this directory or give existing directory in --dbpath.
 See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
Tue Jan 14 16:52:51.338 dbexit:
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: going to close listening sockets...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: going to flush diaglog...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: going to close sockets...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: waiting for fs preallocator...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: lock for final commit...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: final commit...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: closing all files...
Tue Jan 14 16:52:51.338 [initandlisten] closeAllFiles() finished
Tue Jan 14 16:52:51.338 dbexit: really exiting now

2 个答案:

答案 0 :(得分:1)

您提供错误的数据路径

 ERROR: dbpath (\data\db\) does not exist.

\data\db\是默认的mongo数据路径,您需要创建此目录或在运行mongod时提供另一条路径

答案 1 :(得分:0)

运行时

mongod --setParameter textSearchEnabled=true

MongoDB将\data\db\作为dbpath。您的机器中没有,因此您会收到错误。

我看到你有一个包含dbpath等的配置文件,但你没有在启动mongod时指定配置文件。

mongod --config mongo.config --setParameter textSearchEnabled=true

请参阅使用配置文件here

您也可以将textSearchEnabled = true移动到配置文件中。

##store data here
dbpath=C:\mongodb\data

##all output go here
logpath=C:\mongodb\log\mongo.log

##log read and write operations
diaglog=3

setParameter=textSearchEnabled=true

现在你可以通过使用

启动mongod
mongod --config mongo.config