【发布时间】:2016-08-24 02:10:08
【问题描述】:
我正在寻找一种使用 mongoose 填充到别名/虚拟属性的方法?
目前,mongoose 的种群正在向引用属性添加更多字段(通常是标识键)。 我想保留我的原始属性并将引用的数据填充到另一个属性。
例如:似乎我们需要更多关于架构的选项
profile_id: { type: mongoose.Schema.Types.ObjectId, ref: 'profiles', populateTo: 'profile' }
结果返回应该包含两个属性:profile_id 和profile
经过一段时间的搜索,我在github上发现了这个问题:(https://github.com/Automattic/mongoose/issues/3225
【问题讨论】:
标签: mongoose mongoose-populate mongoose-schema