var conn = mongoose.createConnection(config.db);
conn.once('open', function (err) {
if (err) {
next(err);
return;
}
var source = fs.createReadStream(req.files.sample.path);
var gfs = Grid(conn.db, mongoose.mongo);
var id = mongoose.Types.ObjectId();
var target = gfs.createWriteStream({
_id: id,
filename: req.files.sample.name
});
source.pipe(target).on('close', function () {
project.documentation = id;
persistProject(req, res, next, project);
});
When I'm trying to upload it os showing the below error.
Terminating application: undefined
var conn = mongoose.createConnection(config.db); conn.once('open', function (err) { if (err) { next(err); return; } var source = fs.createReadStream(req.files.sample.path);
When I'm trying to upload it os showing the below error. Terminating application: undefined
events.js:72 throw er; // Unhandled 'error' event ^ Error: ENOENT, open 'null/60c0f337f3413edbc5eb3bb27fa3269f'
Why this error is coming? Please help me to solve it.