I got this data in my document:
I want to delete index 0. How do I do this? This should do the trick I thought:
db.collection(\"data\").
It is not currently possible to modify individual elements of an array stored in Cloud Firestore.
If you stored the data as a map (the keys dont matter) like this:
{
name: "sam",
things: {
one: "value",
two: "value"
}
}
Then you can delete individual elements like this:
// Delete the things.one data
db.collection("whatever").document("whatever").updateData([
"things.one": FieldValue.delete(),
]) { err in
if let err = err {
print("Error updating document: \(err)")
} else {
print("Document successfully updated")
}
}
Now the data will look like this:
{
name: "sam",
things: {
two: "value"
}
}