node.js - Mongoose Connection issue -
not able connect mongodb using mongoose getting error
/users/kunal/documents/node/project/taskaccomplisher/node_modules/mongodb/lib/server.js:242 process.nexttick(function() { throw err; }) ^ mongoerror: server 127.0.0.1:27017 received error {"name":"mongoerror","message":"write epipe"} @ null.<anonymous> (/users/kunal/documents/node/project/taskaccomplisher/node_modules/mongodb-core/lib/topologies/server.js:213:40) @ g (events.js:260:16) @ emittwo (events.js:87:13) @ emit (events.js:172:7) @ null.<anonymous> (/users/kunal/documents/node/project/taskaccomplisher/node_modules/mongodb-core/lib/connection/pool.js:119:12) @ g (events.js:260:16) @ emittwo (events.js:87:13) @ emit (events.js:172:7) @ socket.<anonymous> (/users/kunal/documents/node/project/taskaccomplisher/node_modules/mongodb-core/lib/connection/connection.js:151:49) @ socket.g (events.js:260:16) @ emitone (events.js:77:13) @ socket.emit (events.js:169:7) @ onwriteerror (_stream_writable.js:304:10) @ onwrite (_stream_writable.js:322:5) @ writablestate.onwrite (_stream_writable.js:89:5) @ fireerrorcallbacks (net.js:442:13)
code used connect mongodb
var mongoose = require('mongoose') mongoose.connect('mongodb://localhost/test') var db = mongoose.connection; db.on('error', console.error.bind(console, 'connection error:')); db.once('open', function () { console.log('running'); });
how can make mongodb connection node.js
mongod -repair solved issue
Comments
Post a Comment