节点mongodb:错误:由于parseError关闭了连接

编程入门 行业动态 更新时间:2024-10-10 03:29:34
本文介绍了节点mongodb:错误:由于parseError关闭了连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用本地的"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关闭了连接

本文发布于:2023-11-25 09:21:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629198.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:节点   错误   关闭了   mongodb   parseError

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!