You can find the desired record using a sequential check with the for command, as shown in the 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 cnpj is informed, you can collect the other customer data.