// Setup pre-use handler for the update one function. todoSchema.pre("updateOne", function (next) { // Set the updated field to the current datetime. this.update({},{ $set: { updatedAt: new Date() } }); // Continue in the model. next(); });
// Setup pre-use handler for the update one function. todoSchema.pre("updateOne", function (next) { // Set the updated field to the current datetime. this.update({},{ $set: { updatedAt: new Date() } }); // Continue in the model. next(); });