2
You can find the desired record using a sequential check with the command for, as per code example below :
mDatabase = FirebaseDatabase.getInstance().getReference();
mDatabase.child("clientes").addListenerForSingleValueEvent(new ValueEventListener() {
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot snap : dataSnapshot.getChildren()) {
if (Objects.equals(snap.child("cnpj").getValue(), "999.999.999-99")) {
// seu codigo aqui
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
The above code will read sequentially from the first to the last record and if there is the cnpj informed, you can collect the other customer data.
This way you have to always bring all customers and filter on the client. Using firebase Query can filter data and decrease time and amount of data traffic.
– Grupo CDS Informática