The idea is to generate the value by key-passing the generated object like this:
const schema = new Schema({
...,
date: { ... },
duration: {
type: Number,
dummy(mock) {
return Date.now() - this.schema.generated.date; // Use another key to generate other
}
}
});