I have the following structure in my document:
{
"_id": 11111,
"user": "[email protected]",
"sites": [
{
"sitename": "site1",
"url": "site2.com",
"keywords": [],
},
{
"sitename": "site2",
"url": "site2.com",
"keywords": [],
},
{
"sitename": "site2",
"url": "site2.com",
"keywords": [],
},
]
},{
"_id": 2222,
"user": "[email protected]",
"sites": []
}
I'm going to find the document by ID(id:11111).there is multiple documents. Then I want to add new site to sites array in the document that contain 1111 _id. if sitename already have, the site should not add. How can I achieve this ?