'How to append element into an object inside an array of objects in dynamodb with node.js
This is my item in a dynamodb table. I am trying to append data into an object that is inside an array. i am pretty new dynamodb. I tried using KeyExpression but that seem to work with only key items.
{
"category": "Causal Wear",
"styles": [
{
"style_Id": "534f",
"sizes": [
"xl",
"l",
"xs"
],
"colors": [
"red",
"green",
"yellow"
]
},
{
"style_Id": "3435",
"sizes": [
"xl",
"l",
"xs"
],
"colors": [
"red",
"green",
"yellow"
]
},
{
"style_id": "crnd9201"
}
]
}
and I want to append data into a object with style_id = "crnd9201"
This is my data
{
"sizes":['xl'],
"colors":['red','blue']
}
this is what i am trying to achive
{
"category": "Causal Wear",
"styles": [
{
"style_Id": "534f",
"sizes": [
"xl",
"l",
"xs"
],
"colors": [
"red",
"green",
"yellow"
]
},
{
"style_Id": "3435",
"sizes": [
"xl",
"l",
"xs"
],
"colors": [
"red",
"green",
"yellow"
]
},
{
"style_id": "crnd9201",
"sizes":['xl'],
"colors":['red','blue']
}
]
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
