Category:2010 films
Category:Indian films
Category:2000s Hindi-language films
Category:Hindi remakes of Tamil films
Category:Indian remakes of South Korean films
Category:Films shot in AustriaQ:
Mongodb find match for array and create a new array element
I have an array with objects
this.jobs = [
{
"id" : "1",
"company_id" : "3",
"color" : "red",
"items_count" : 2
},
{
"id" : "2",
"company_id" : "3",
"color" : "black",
"items_count" : 2
},
{
"id" : "3",
"company_id" : "3",
"color" : "green",
"items_count" : 3
},
{
"id" : "4",
"company_id" : "3",
"color" : "blue",
"items_count" : 4
},
{
"id" : "5",
"company_id" : "3",
"color" : "orange",
"items_count" : 1
}
]
I need to find if company has "red" items and if so create a new array and add to it a new object with "blue" and "orange".
Output:
[{
"id" : "1",
"company_id" : "3",
"color" : "red",
"items_count" : 2
},{
"id" : "2",
"company_id" : "3",
"color" : "black",
"items_count" : 2
},{
"id" : "3",
"company_id" : "3",
"color" : "green",
"items_count" : 3
},{
"id be359ba680
Related links:
תגובות