在猫鼬中,我应该为UserProfile创建其他shema还是应该在User Schema中嵌入UserProfile,这更好。

现在我已经为用户配置文件创建了不同的模式,并引用了用户模式,而我的用户配置文件模式我大约有50-60个文档(字段)。

const user = new mongoose.Schema({
    a: { type: String,required: true},
    b: { type: String,required: true},
    profile:{
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Profile'
    },
})
const profile = new mongoose.Schema({
    a: { type: String,required: true},
    b: { type: String,required: true},
})