问题
banco firestore
I need to update a status field in the index array [0] where time == 8:00, I need to pass this status to == "0", only that this array is inside a matrix that here in the image can be seen as a timer. How could I update this vector at index [0] by changing the status = 1 field to = 0?
To update a status outside an array and passing the values by hand I am using an example like this for testing only:
Firestore.instance.collection("area").document("alergia").collection("items")
.document("RGiqOihmSxUlpVVEqPUo").collection("agenda").document("bgMHxqQEpt8Tha0pdOcY")
.updateData({"statusdata": 0});
回答1:
Firestore doesn't offer any updates that allow you to directly change array items by their index. You will have to write code to read the document, modify the array in memory to be the way you want, then update the array field back to the document.
来源:https://stackoverflow.com/questions/61212886/flutter-how-to-update-an-array-within-an-array-in-the-firestore