问题描述
我有以下解释的猫鼬报价模型:
const OfferSchema = new Schema({
sections: [
{
title: String,},],});
引用了第一个方案要约的和订单方案如下:
const OrderSchema = new Schema({
offers: [
{
offer: { type: Schema.Types.ObjectId,ref: 'Offer' },sections: [
{
section: { type: Schema.Types.ObjectId,ref: 'Offer.sections' },// issue here
},});
我无法在此处{section: { type: Schema.Types.ObjectId,ref: 'Offer.sections' }}
填充部分的问题
它给了我MissingSchemaError: Schema hasn't been registered for model "Offer.sections".
那么有什么方法可以填充节吗?
解决方法
不幸的是,猫鼬不支持此功能。 检查Github问题here
您可以将部分嵌入订单模式的替代解决方案