I have the following MongoDB document:
{
"_id": ObjectId(),
"sku": "V4696-DR-V33",
"options": [
{
"sku": "8903689984338",
"stores": [
{
"code": "AND1",
"zipcode": "110070",
"inventory": -1000
},
{
"code": "AND2",
"zipcode": "201010",
"inventory": -1000
},
{
"code": "AND3",
"zipcode": "411001",
"inventory": -1000
},
{
"code": "AND4",
"zipcode": " 700020",
"inventory": -1000
},
{
"code": "AND5",
"zipcode": "110015",
"inventory": -1000
}
],
"price": 2199,
"_id": ObjectId(),
"size": "14"
},
{
"sku": "1742564789",
"stores": [
{
"code": "AND1",
"zipcode": "110070",
"inventory": -1000
},
{
"code": "AND2",
"zipcode": "201010",
"inventory": -1000
},
{
"code": "AND3",
"zipcode": "411001",
"inventory": -1000
},
{
"code": "AND4",
"zipcode": " 700020",
"inventory": -1000
},
{
"code": "AND5",
"zipcode": "110015",
"inventory": -1000
}
],
"price": 2199,
"_id": ObjectId(),
"size": "14"
},
]
}
I want to update each inventory value where code value is "AND1" . I want query in mongo query or any python script to update whole document with nested value. I am very Stuck with This Issue.