I have a Company mongodb structure like this:
{ "companyName" : "SomeCompany",
"Products" : [
{
"productId" : "e3rQACssGkfp9zsue",
"productCode" : "271102502",
"memberPrice" : "200",
},
{
"productId" : "e3rQACssGkfp9zsue",
"productCode" : "271102502",
"memberPrice" : "500",
},
]
}
Each Company has a nested object called Products, which has its own attributes. How can I loop through the object to print out just the memberPrice from Products? I am trying to do something like:
console.log(Company.Products.memberPrice)
which returns undefined...