2016-09-28 54 views
0

上我检查的MongoDB服务在运行,我可以连接的MongoDB unsing /bin/mongo.exe 使用驱动程序的NodeJS我无法连接到服务器的MongoDB。无法连接使用mongodbDriver的MongoDB的NodeJS Windows Server 2003的

我的代码正在使用Windows 10.错误消息如下。

C:\Documents and Settings\Administrator\Desktop\src\server>node server.js 
Listening on port 80 

C:\Documents and Settings\Administrator\Desktop\src\server\node_modules\mongodb\ 
lib\mongo_client.js:225 
      throw err 
     ^
MongoError: failed to connect to server [127.0.0.1:27017] on first connect 
    at null.<anonymous> (C:\Documents and Settings\Administrator\Desktop\src\ser 
ver\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:313: 
35) 
    at emitOne (events.js:77:13) 
    at emit (events.js:169:7) 
    at null.<anonymous> (C:\Documents and Settings\Administrator\Desktop\src\ser 
ver\node_modules\mongodb\node_modules\mongodb-core\lib\connection\pool.js:260:12 
) 
    at g (events.js:260:16) 
    at emitTwo (events.js:87:13) 
    at emit (events.js:172:7) 
    at Socket.<anonymous> (C:\Documents and Settings\Administrator\Desktop\src\s 
erver\node_modules\mongodb\node_modules\mongodb-core\lib\connection\connection.j 
s:162:49) 
    at Socket.g (events.js:260:16) 
    at emitOne (events.js:77:13) 

回答

0

使用较低版本的mongodb驱动程序。 在这种情况下,我使用1.4。