Answer the question
In order to leave comments, you need to log in
How to make default values from another document?
For example:
const schema = new Schema({
order: { type: Schema.Types.ObjectId, ref: 'orders', required: true },
user: { type: Schema.Types.ObjectId, ref: 'user', required: true },
offeredPrice: { type: Schema.Types.Decimal128, default: 0.00 }
},
{ timestamps: true }
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question