I currently have a collection stored in Firebase Realtime Database structured like this:
https://i.sstatic.net/jNiaO.png
My requirement is to remove the first element (the one ending with Wt6J) from the database using firebase-admin
.
Below is the code snippet I tried, but it didn't work as expected:
const deleteNotification = () => {
const key1 = 'FhN6Ntw8gyPLwJYVzcHy0E8Wq5z2';
const key2 = '-MzGhZ2psGLivIfTWt6J';
const notsRef = db.ref(`notifications/${key1}/${key2}`);
notsRef.remove();
};
Can anyone suggest the correct method to use for deleting a specific field? Any insights on how I can achieve this task?