‫In the previous video, we learned how to save data to any document and how to get all documents in
‫the collection.
‫In this video, we'll learn how to update a specific document.
‫Let's start by getting the name and email from the edit text.
‫Then I'll use my or friend reference dot update method.
‫Here I need to specify either a map or a string field and object object, or a field path object and
‫object parameters.
‫I'll use the map and this map will start with the key value pairs.
‫I need to update the name, for example, and the value of the new name would be the name.
‫Get it from edit text.
‫You can use the email also, so I'll copy it.
‫Update email.
‫Weather email.
‫If we go up to friends.
‫Reference in the collection of users in the document friends here.
‫The document friends is not found because if we open our Cloud Firestore dashboard, we have this collection
‫users and we have two documents.
‫And these are the names of these documents.
‫So I can't create a friends document.
‫Only one document.
‫These documents are generated automatically when we insert them.
‫I need to click on one of them and copy its name or the ID.
‫This is for John.
‫So whenever I need to update a specific document, I need to paste its ID or its name, or its path.
‫Let's call this in the update button.
‫So update specific document and run the application.
‫This is our application I'll enter a new name for example Ali Ali at gmail.com.
‫Click on update data.
‫You will see how the email and name for this document will be changed.
‫Refresh.
‫And here we go.
‫The name and email are updated.
‫So this is how we update a specific document in the Firestore.
‫Now let's move to the delete data.
‫So here I'll add delete button dot set on click listener new view and click listener.
‫And I need to call a method called Delete All and I'll create it here.
‫It's very simple.
‫I'll use friend ref dot delete.
‫This will delete the friends ref which indicates this specific document.
‫Let's run click on Delete data refresh and you can see the users collection only contains one document.
‫So congratulations guys!
‫We learned about the basic operations save, read, update and delete data with Firebase Firestore.