I have following document on which the update needs to be done.
{
"_id": "Colorcode_1",
"Combination": [
{
"color": [
{
"mixture": [
"Red",
"Green"
]
}
],
"code": "Maroon"
},
{
"color": [
{
"mixture": [
"Yellow",
"Green"
]
}
],
"code": "Light Green"
}
]
}
Now what I need to do is to update the document by adding the value "Blue" in the "mixture" field where "code" is "Maroon". Something like this. This needs to be done using $addToSet
{
"_id": "Colorcode_1",
"Combination": [
{
"color": [
{
"mixture": [
"Red",
"Green",
"Blue"
]
}
],
"code": "Maroon"
},
{
"color": [
{
"mixture": [
"Yellow",
"Green"
]
}
],
"code": "Light Green"
}
]
}
Any help regarding this would be highly helpful.
"color"
an array?