How to delete one entry in a user in the Firebase database?
I don’t remember how to delete these entries! help me, please!
How to delete one entry in a user in the Firebase database?
I don’t remember how to delete these entries! help me, please!
Just make sure of changes of id to given id and Another by using uid.
FirebaseDatabase.getInstance().getReference().child("Markers").(id).child(uid).removeValue();
To remove that value, you should add to your reference the keys of all nodes. So please use the following lines of code:
String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference uidRef = rootRef.child("Markers").child(uid);
uidRef.child("-M5957WblHTL3Eu-1jnE").removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Log.d("TAG", "Child deleted!");
} else {
Log.d("TAG", task.getException().getMessage());
}
});