If I have a property in my schema that depends on another one (like it's minimum value), how do define that in my schema?
I have an endDate and an actualEndDate properties in my schema, the second one will always be greater than or equal to the first one, how do I put that in my schema
const schema = new mongoose.Schema({
endDate: {
type: Date,
min: new Date(),
required: true
},
actualEndDate: {
type: Date,
min: new Date(), // I need this to be min: this.endDate or something
}
});