1

Is it possible to update a single value in a Firestore document that's in an array? For example, if I have a document like this is there a way to update just the size property of the second item?

{
    "name": "Name",
    "items": [
        {
            "size": 10
        },
        {
            "size": 20
        }
    ]
}

I can update a first-level property using the updateData method like this but I'm not sure how I would construct the data to update a value that's in an array.

NSDictionary *data = @{@"name": @"New Name"};
[documentReference updateData:data completion:^(NSError * _Nullable error) {

}];
Berry Blue
  • 15,330
  • 18
  • 62
  • 113

0 Answers0