I would like to delete the last deed within deeds which happens to be deed id: 1. I would like to do this without specifying anything other than deleting the last deed in deeds.
Here is what I have tried already, but I receive no function errors because i'm returning query type objects.
const deedRef = admin.database().ref('/deeds');
deedRef.limitToLast(1).once("value", (snapshot) => {
snapshot.val().remove();
})
And
const deedRef = admin.database().ref('/deeds');
deedRef.limitToLast(1).once("value", (snapshot) => {
snapshot.forEach((deedSnapshot) =>{
deedSnapshot.remove();
})
})
And I've tried this
const deedRef = admin.database().ref('/deeds');
deedRef.limitToLast(1).remove();
How can I reference the last deed in deeds and remove it? The last deed will constantly change.
