0

i am stuck with a problem with firebase (with Vue). I want to add the user id to a specific map (yes, maybe or no) when the user presses a specific button. But Im having trouble add/update the data because its nested. Here is my data structure in Firestore

firestore data structure

I want to add the user id in a map, something like this:

dates: {
    [
        0: {
            yes: [userId1, userId2]
        }
    ]
}

Does anyone can help me pushing the user ids into the arrays?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
ynckblw
  • 23
  • 4

1 Answers1

1

Unfortunately, right now it is not possible to update a specific element of the array. You can add new items or remove them - look here. But I would consider a little change in the approach and create a collection called dates in which you can define documents, which will contain yes, no, maybe arrays, which can be easily updated - in the way mentioned before.

TymoteuszLao
  • 844
  • 1
  • 5
  • 16