Crisboot
Crisboot

Reputation: 1480

MongoError: write EPIPE

I'm using Node.JS + Mongoose + MongoDB. Had my app working ok until now, now when trying to save a document:

Saving operation:

doc.save(function(err, d){
    console.log(err,d); 

{"name":"MongoError","message":"write EPIPE"}

Error stack:

{ [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)

Looks like I'm able to read data, but not to write new documents. Mongo is app and running. I've tried so far, restarting the DB, with no good results.

Just tried to insert from mongo client and worked

> db.mysecretcollection.insert({url:"sampletestremoveme"});
WriteResult({ "nInserted" : 1 })

So it seems to be a Node.js / Mongoose issue.

Upvotes: 4

Views: 6160

Answers (1)

Crisboot
Crisboot

Reputation: 1480

It seems to me that the document was too big, actually I was able to save it after removing one of its fields. The weird thing is that mongoose should catch that with "Error: Document exceeds maximum allowed bson size of XXX bytes" exception, but that was never thrown.

Upvotes: 2

Related Questions