Hello my problem is quite difficult. Please help. This is my cart. I am using a query that's failing me:
interface CartInterface extends Document {
products: Array<{
quantity: number,
productDetails: PopulatedDoc<ProductInterface>
}>,
}
I used this query: Cart.findById(req.params.id).populate('products.productDetails') but it's wrong. I need to go inside each array and find each object
I need to populate all arrays so products[index].productDetails.
I populated products.productsArray easily last time quite easily last time when my schema was like this:
interface CartInterface extends Document {
productsArray: Array<PopulatedDoc<ProductInterface>>
}
I used this query:
Cart.findById(req.params.id).populate('productsArray')