Is it possible to update a field using the value of another field?
Here is my schema
var timeSchema = new mongoose.Schema({
hours: Number,
minutes: Number
});
module.exports = mongoose.model("Time", timeSchema);
I want the value of minutes to be hours * 60 when minutes become 0
Here is my code
Time.updateMany({}, {minutes: hours * 60});
My code throws an error which says hours is not defined
Is there any possible way to update minutes using the value of hours?