From the course: iOS Development with Firebase

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Update data in Firestore

Update data in Firestore

- [Instructor] Now we're gonna look at how to update data that's stored in Firestore on the server. We've seen how you can get a document reference and call .setData on it to create a new document with that data. You can also get a document reference to an existing document on the server and call .setData. That will override the data that's already on the server. There's an option to pass and merge, and that way, if the document does already exist, it'll try to merge the two sets of data. You can also update specific fields in the document with a call to .updateData passing in the key-value pair. Again, we'll get the document reference with .document and pass in the identifier, so that'll have to be known. Also, if you have nested dictionaries in your data, you can update those with dot notation and we'll look at that also. So first let's look at the data that we have on the server. Currently, we have the collection called winner and we have three documents in it. One of them has the…

Contents