有两个架构作业和一个用户
const JobSchema: Schema = new Schema(
location: {
type: mongoose.Types.ObjectId,
ref: '',
required: true,
trim: true,
},
},
const UserSchema: Schema = new Schema(
email: { type: String, required: true, unique: true, trim: true },
addresses: [
{
address: {
title: String,
house: String,
street: String,
},
},
],
}
我在位置字段中存储了地址ID, 但模型是userModel, 因此,如何从一个模型填充到另一个模型的嵌套数组ID?