我正在使用Node.JS + Mongoose + MongoDB。我的应用程序到目前为止工作正常,现在在尝试保存文档时:
保存操作:
{ [MongoError: server localhost:27017 received an error {"name":"MongoError","message":"write EPIPE"}]
name: 'MongoError',
message: 'server localhost:27017 received an error {"name":"MongoError","message":"write EPIPE"}' } undefined
error: TypeError: Cannot read property 'url' of undefined
at EventEmitter.<anonymous> (/home/ec2-user/c/index.js:160:61)
at EventEmitter.<anonymous> (/home/ec2-user/c/node_modules/mongoose/node_modules/mpromise/lib/promise.js:174:48)
at EventEmitter.emit (events.js:95:17)
at Promise.safeEmit (/home/ec2-user/c/node_modules/mongoose/node_modules/mpromise/lib/promise.js:81:21)
at Promise.reject (/home/ec2-user/c/node_modules/mongoose/node_modules/mpromise/lib/promise.js:109:15)
at Promise.error (/home/ec2-user/c/node_modules/mongoose/lib/promise.js:94:15)
at Promise.resolve (/home/ec2-user/c/node_modules/mongoose/lib/promise.js:112:24)
at /home/ec2-user/c/node_modules/mongoose/lib/document.js:1555:39
at handleError (/home/ec2-user/c/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:40:22)
at next_ (/home/ec2-user/c/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:75:26)
{“name”:“MongoError”,“message”:“写EPIPE”}
错误堆栈:
> db.mysecretcollection.insert({url:"sampletestremoveme"});
WriteResult({ "nInserted" : 1 })
看起来我能够读取数据,但不能写新文档。 Mongo是app并且正在运行。到目前为止,我已经尝试过,重新启动数据库,没有很好的结果。
刚尝试从mongo客户端插入并工作
{{1}}
所以它似乎是一个Node.js / Mongoose问题。
答案 0 :(得分:2)
在我看来,文档太大了,实际上我可以在删除其中一个字段后保存它。奇怪的是,猫鼬应该用&#34;错误:文件超过允许的最大bson大小为XXX字节&#34;例外,但从未抛出过。