Model.findById(req.body.myid, function (err, results) {
var doc = new Model(results);
doc._id = mongoose.Types.ObjectId();
doc.serial = req.body.serial;
doc.remarks = req.body.remarks;
doc.save(function(err) {
if(err){
res.json({ success: false });
}else {
res.json({ success: true });
}
});
});
How can i create copy of a document and save using mongoosejs ??
results.toObject()code(node:8260) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: mongoosejs.com/docs/promises.html { Error at model.wrappedPointCut [as save] message: 'No matching document found for id, name: 'VersionError' }codecodedoc.isNew = true;code