Coupen Sammlung Vor-UpdateMongoDB - Update-Objekte in der Seite eine verschachtelte Array in einer Sammlung (verschachtelte Aktualisierung)
{
"_id": ObjectId("571501b7cbd85fe5ce5a749c"),
"storeCode": "LULUMALL",
"offers": [{
"name": "offer1",
"coupens": [
{ "coupen": "adssd", "status": "open" },
{ "coupen": "sdsafa", "status": "open" },
{ "coupen": "wewerw", "status": "open" },
{ "coupen": "cvvdf", "status": "open" },
{ "coupen": "dfdfadf", "status": "open" },
{ "coupen": "dfdfd", "status": "open" },
{ "coupen": "dfdf", "status": "open" },
{ "coupen": "dfsdf", "status": "open" }
}
]
},
{
"name": "offer2",
"coupens": [
{ "coupen": "dffddd", "status": "open" },
{ "coupen": "dfdfdf", "status": "open" },
{ "coupen": "sdfsdf", "status": "open" },
{ "coupen": "dfdfdf", "status": "open" },
{ "coupen": "sfsdfd", "status": "open" },
{ "coupen": "dffdfd", "status": "open" },
{ "coupen": "sdfsdf", "status": "open" },
{ "coupen": "dfdfdd", "status": "open" },
{ "coupen": "dfdfdf", "status": "open" },
{ "coupen": "dfdfdf", "status": "open" },
{ "coupen": "dfsdff", "status": "open" },
]
}]
}
Ich habe storeCode
, offer name
& coupen
.So Ich brauche die status
des entsprechenden aktualisieren Objekt auf alloted
.
Für Ex: Wenn storeCode
= LULUMALL, name
= Angebot1 & coupen
= adssd, also muss ich die status
des entsprechenden Objekts allotted
.Nach Update aktualisieren, The Collection sollte so sein. Coupen Sammlung Nach einem Update
{
"_id": ObjectId("571501b7cbd85fe5ce5a749c"),
"storeCode": "LULUMALL",
"offers": [{
"name": "offer1",
"coupens": [
{ "coupen": "adssd", "status": "allotted" },
{ "coupen": "sdsafa", "status": "open" },
{ "coupen": "wewerw", "status": "open" },
{ "coupen": "cvvdf", "status": "open" },
{ "coupen": "dfdfadf", "status": "open" },
{ "coupen": "dfdfd", "status": "open" },
{ "coupen": "dfdf", "status": "open" },
{ "coupen": "dfsdf", "status": "open" }
}
]
},
{
"name": "offer2",
"coupens": [
{ "coupen": "dffddd", "status": "open" },
{ "coupen": "dfdfdf", "status": "open" },
{ "coupen": "sdfsdf", "status": "open" },
{ "coupen": "dfdfdf", "status": "open" },
{ "coupen": "sfsdfd", "status": "open" },
{ "coupen": "dffdfd", "status": "open" },
{ "coupen": "sdfsdf", "status": "open" },
{ "coupen": "dfdfdd", "status": "open" },
{ "coupen": "dfdfdf", "status": "open" },
{ "coupen": "dfdfdf", "status": "open" },
{ "coupen": "dfsdff", "status": "open" },
]
}]
}