I am currently working with a Company mongodb structure that looks like this:
{ "companyName" : "SomeCompany",
"Products" : [
{
"productId" : "e3rQACssGkfp9zsue",
"productCode" : "271102502",
"memberPrice" : "200",
},
{
"productId" : "e3rQACssGkfp9zsue",
"productCode" : "271102502",
"memberPrice" : "500",
},
]
}
Within each Company, there is a nested object called Products with its own set of attributes. My goal is to loop through this object and only print out the memberPrice from Products. I have attempted to achieve this using the following code snippet:
console.log(Company.Products.memberPrice)
Unfortunately, this code returns undefined...