Update Without where
How to increment only child period of all students enrolled in Firebase?
Ex.: in SQL, I would use:
UPDATE alunos
SET periodo = periodo + 1
Updating all students for their later period. How can I do in Firebase?
3
Author: Tiago Emerenciano, 2017-10-20
1 answers
I was able to accomplish what I needed by adapting the code below
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference usersRef = rootRef.child("users");
ValueEventListener eventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String true = "true";
for(DataSnapshot ds : dataSnapshot.getChildren()) {
ds.child("SubmitCheck").getRef().setValue(true);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
usersRef.addListenerForSingleValueEvent(eventListener);
2
Author: Tiago Emerenciano, 2017-10-21 01:29:05