I'm following the guide here for removing values from my firebase database. Here is the structure of my data.
|---users
|----KJSXd4ScEmJ6N4UFc5k
|---bookmarks
|---KdCyKdQkDg34ny6_H-C
|---id:"12d5j2fa-0f70-41c3-b4g4-4d66bdcef976"
|---KdCyKdQkDg34ny6_H-M
|---id:"fa95b1fa-b537-4d98-a0e7-a92ffea7b6a4"
Here's the code I'm using.
FirebaseDatabase.getInstance().getReference().child(MyConstants.FIREBASE_USERS_NODE).child(FirebaseAuth.getInstance().getCurrentUser().getUid())
.child(MyConstants.FIREBASE_BOOKMARKS_NODE).orderByChild("id").equalTo(uuid).addListenerForSingleValueEvent(
new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
dataSnapshot.getRef().removeValue();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
What's happening is the entire /bookmarks node gets deleted on this single call instead of just the reference to the bookmark wanted. How is it that I can achieve just deleting the single bookmark I want to delete instead of the whole node?