My approach would be to get the document instance, and create a new one from the instance fields. I am sure there is a better way to do it.
You need to reset d1.isNew = true;
as in:
Model.findById(yourid).exec(
function(err, doc) {
doc._id = new mongoose.Types.ObjectId();
doc.isNew = true; //<--------------------IMPORTANT
doc.save(callback);
}
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With