0

I want to populate productId and distributor. following is the array in my schema:

  products: [
    {
        productId: {
            type: String,
            required: true,
            ref: 'companyProduct'
        },
        quantity: {
            type: String,
            required: true,
        },
        distributor: {
            type: String,
            required: true,
            ref: 'distributor'
        }
    }
],
  • 1
    Does this answer your question? [Multiple populates - mongoosejs](https://stackoverflow.com/questions/12821596/multiple-populates-mongoosejs) – turivishal Aug 14 '20 at 17:59
  • since products is an array in your schema, you need deep population: https://stackoverflow.com/a/50301562/4718434 – yaya Aug 14 '20 at 18:12

0 Answers0