0

I have an Array like this:

enter image description here

I need to add another id to group_name = Group 2 (add a new id to devices).

BIS Tech
  • 17,000
  • 12
  • 99
  • 148

1 Answers1

0

Currently this is not possible with firestore as in this question. I would suggest to make the outer array an object and then it would be possible to do somthing like this:

firestore.instance.
    .collection('friendships')
    .document(caller.data["uid"])
    .updateData({
         "groups.groupId": {
              FieldValue.arrayUnion({
              friendDisplayName: snapshot.data["friendDisplayName"],
              friendUid: snapshot.ref
         })
});
Zvi Karp
  • 3,621
  • 3
  • 25
  • 40