Как изменить значение child-a в firebase?
public void updateDate(final Long oldDate, final Long newDate) {
myRef = fbDatabase.getReference(getUid());
myRef.keepSynced(true);
myRef.child(TABLE_OPERATIONS)
.orderByChild(COLUMN_DATE)
.equalTo(oldDate)
.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
CategoryList post = postSnapshot.getValue(CategoryList.class);
if (post.getDate() == oldDate) {
postSnapshot.getRef().child(COLUMN_DATE).setValue(newDate);
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}