使用本地的"mongodb" npm软件包,我收到
Using the native 'mongodb' npm package, I'm receiving
Error: connection closed due to parseError进行非常基本的查询时:
When making a very basic query:
collections.myCollection.findOne({id: someID}, function (err, repo) { ... })奇怪的是,之前已经运行过完全相同的查询.每个查询的类型均相同,等等.
The weird thing is, the exact same query has run before. Types are identical for each query, etc.
推荐答案回答我自己的问题,以希望阻止下一个人扯掉头发:
Answering my own question to hopefully stop the next person from tearing their hair out:
如此处所述,此错误消息没有用,并且与实际问题无关. 生产型Mongo驱动程序将所有错误丢弃在catch块中.
要查找实际的错误是什么:
To find what the error actually is:
-
打开您的node_modules/mongodb
找到server.js
寻找mongoReply.parseBody
登录err可以看到实际上有用的内容.
log the err to see something actually useful.
就我而言:
ReferenceError: collection is not defined编辑: Node MongoDB本机1.4现在稳定,并包含对此错误的修复程序.
Edit: Node MongoDB native 1.4 is now stable, and includes a fix to this bug.
更多推荐
节点mongodb:错误:由于parseError关闭了连接
发布评论