我正在 Node 服务器中使用 MongoDB。
我有一个父进程,它生成新的子进程,每个进程都会执行一些函数,然后将结果保存在 mongo 中,之后我将其停止:
process.exit()
我不知道为什么,这个子进程的一些向我抛出了这个错误:
{ MongoError: server localhost:27017 received an error
{"name":"MongoError","message":"write EPIPE"}
at .<anonymous> (/node_modules/mongodb-core/lib/topologies/server.js:213:40)
at g (events.js:286:16)
at emitTwo (events.js:106:13)
at emit (events.js:191:7)
at .<anonymous> (/node_modules/mongodb-core/lib/connection/pool.js:119:12)
at g (events.js:286:16)
at emitTwo (events.js:106:13)
at emit (events.js:191:7)
at Socket.<anonymous> (/node_modules/mongodb-core/lib/connection/connection.js:151:49)
at Socket.g (events.js:286:16)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at onwriteError (_stream_writable.js:319:10)
at onwrite (_stream_writable.js:337:5)
at WritableState.onwrite (_stream_writable.js:89:5)
at fireErrorCallbacks (net.js:462:13)
at Socket._destroy (net.js:503:3)
at WriteWrap.afterWrite (net.js:796:10)
name: 'MongoError',
message: 'server localhost:27017 received an error
{"name":"MongoError","message":"write EPIPE"}' }
我缺少一些配置吗?来自 Mongo 的“write EPIPE”错误意味着什么?
技术:
- MongoDB 版本:3.2.9
- Node 版本:v6.4.0
最佳答案
我在这里看到的一个可能的问题。
很可能是您的某些文档太大。尝试从文档中删除一些字段,看看是否仍然存在此问题。
很奇怪为什么 mongo 没有显示正确的错误,但我发现很多人都有同样的问题。
http://databasefaq.com/index.php/answer/119679/nodejs-mongodb-mongoose-epipe-mongoerror-write-epipe
希望这有帮助。
关于node.js - 蒙戈错误: write EPIPE in node server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39168786/