I want to insert a value to the array in the array of the sub document when the value is not already there.I have a collection like this
{
"_id" : ObjectId("53993f67ccbc960c7d05b74f"),
"groups" : [
{
"groupName" : "Default",
"groupMembers" : [ ]
},
{
"groupMembers" : [ ],
"groupName" : "Family"
},
{
"groupName" : "Friends",
"groupMembers" : ["jack" ]
}
],
"userName" : "krishna",
}
Now i want to find the a value in Friends
group and if the value is not there and it should be inserted.