Having Firebase RealTime Database in Firebase application having web and android as client. Inserting values to the database by using push()
method which generates random key and all the sub key value pairs are stored in the child by the web client. Now, I want to update some key value pairs of particular child by android. For example
KHSIHJKJBNJXKCB -
name="xyz"
age=19
JHGISFUSHFIJDSF -
name="abc"
age=20
How to update "age" attribute of particular key, by not using the key KJHUJHDFIUSH
etc. just something like update age to 25 where name is "abc".
UPDATE
where "student 0" is replaced by some random values generated by Firabase. So I want to change the value "isCertificateReady" to false. How can I refer to the specific node while not knowing the key of the node. For this example we can use contact number as unique id.
The code which I used to solve the problem or get the things working on getting answer
coachingDatabaseReference.orderByChild("contactNumber")
.equalTo(contactNumber)
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String key = dataSnapshot.getKey();
coachingDatabaseReference.child(key)
.child("isCertificateReady")
.setValue(false);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});