How to update other field based on email id in fire store android

enter image description here

This is my fire store database i am trying to update phone number based on email id .
below code i am trying to updated phone

firebaseFirestore.collection("Users")
                        .document("anilkt87@gmail.com")
                        .update("phone",897389121 );

but i am unable to update i am new in fire store can any one help me in this.

>Solution :

firebaseFirestore.collection("Users")
                            .document("anilkt87@gmail.com")
                            .update("phone",897389121 );

This code mean you are operate a document that id is anilkt87@gmail.com, But it is a field value in you screenshot not id, In this scenario you have to run query first, Then update those documents.

Leave a Reply