【问题标题】:Connecting to a MongoDb in Node.js Error在 Node.js 错误中连接到 MongoDb
【发布时间】:2011-10-25 16:12:05
【问题描述】:

很简单,我正在尝试通过 Node.js 连接到 MongoDB:

Db = require('../v2/node_modules/mongodb').Db
Connection = require('../v2/node_modules/mongodb').Connection
Server = require('../v2/node_modules/mongodb').Server

console.log "before"
DbServer = new Server("localhost", 27017, {})
db = new Db("twitter", DbServer, {native_parser:true})
console.log "after"
return

这是我的代码,它非常简单。然而,我的输出似乎停在db = new Db... 行。

它永远不会到达之后。它也没有给出错误。我知道我有一个数据库正在运行,当我启动 MongoHub 时,它与 twitter 数据库一起存在

【问题讨论】:

    标签: mongodb node.js


    【解决方案1】:

    只要去掉 native_parser=true 就可以了

    Native bson parser not compiled, please compile or avoid using native_parser=true

    【讨论】:

      猜你喜欢
      • 2019-03-06
      • 2013-11-02
      • 2013-12-21
      • 2023-03-27
      • 1970-01-01
      • 2014-06-04
      • 1970-01-01
      • 1970-01-01
      • 2019-05-27
      相关资源
      最近更新 更多