0

I have group document within the document I have members. Every group have unique groupId and I want to add new members to groups based on the groupId

group table

{
"_id" : ObjectId("6011208469d905d40038ddc5"),
"groupId: ObjectId("5fd484439590020dc0dfb829"),
"name" : "Fun Friends",
"members" : [ 
        {
            "isdCode" : "001",
            "phone" : "11"
        }, 
        {
            "isdCode" : "001",
            "phone" : "12"
        }
    ]
}

exepected output

{
"_id" : ObjectId("6011208469d905d40038ddc5"),
"groupId: ObjectId("5fd484439590020dc0dfb829"),
"name" : "Fun Friends",
"members" : [ 
        {
            "isdCode" : "001",
            "phone" : "11"
        }, 
        {
            "isdCode" : "001",
            "phone" : "12"
        },
        {
            "isdCode" : "001",
            "phone" : "13"
        }
    ]
}

Thanks!!

AsZik
  • 621
  • 1
  • 4
  • 20

0 Answers0