【问题标题】:Failed to connect mongodb from nodejs using mongodbDriver on windows server 2003无法在 Windows Server 2003 上使用 mongodbDriver 从 nodejs 连接 mongodb
【发布时间】:2017-02-06 02:26:41
【问题描述】:

我检查了 MongoDB 服务是否正在运行,我可以连接 MongoDB unsing /bin/mongo.exe 但是我无法使用 nodejs 驱动程序连接到 MongoDB 服务器。

我的代码在 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)

【问题讨论】:

    标签: node.js mongodb windows-server-2003


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2015-07-28
      • 2011-04-22
      • 1970-01-01
      • 2020-06-16
      • 1970-01-01
      • 2023-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多