I want to add a new field in a array but when i try to add a new field it will remove rest and add only the remaining one. i tried this but not working
collectionRef
.doc("userIdLalit")
.collection("stories")
.doc("BHUCC3ewEeByJ6U68ygJ")
.update(
{
"reactionModel": {
"user": [
{"fourth element": "Sam"},
],
}
},
);
This code will remove the 0th and 1st element and add the fourth element but i want all of them whenever i add a new field
I tried with set method with merge true but didnt work