如何在猫鼬数组的对象中填充2个ID

时间:2020-08-14 17:55:07

标签: mongodb mongoose populate mongoose-populate

我要填充productId和分配器。 以下是我的架构中的数组:

  products: [
    {
        productId: {
            type: String,
            required: true,
            ref: 'companyProduct'
        },
        quantity: {
            type: String,
            required: true,
        },
        distributor: {
            type: String,
            required: true,
            ref: 'distributor'
        }
    }
],

0 个答案:

没有答案