{
"_id": "1",
"style": "13123",
"category": "dress",
"colors": {
"Black": {
"prestock": 50,
"instock": 60,
"inactive": 0
},
"Blue": {
"prestock": 30,
"instock": 0,
"inactive": 0
},
"Red": {
"prestock": 10,
"instock": 60,
"inactive": 0
}
}
}
i have above json, i need to access to prestock, instock, and inactive. but colors' value will change depending on styles. for example:
{
"_id": "2",
"style": "14321",
"category": "top",
"colors": {
"Green": {
"prestock": 50,
"instock": 60,
"inactive": 0
},
"Yellow": {
"prestock": 50,
"instock": 60,
"inactive": 0
}
}
}
how can i query this in mongodb? would this something that's related to Object.keys(obj)?
ps.if this is a duplicate question please guide me!
Thanks!