Seeking assistance in retrieving the most recently added child in a cloud function. Below is the code snippet I am using and I'm curious if there is a specific function or query I can utilize to achieve this task without having to iterate through each child element.
exports.makeUppercase = functions.database.ref('aaa-fff/searchIndex')
.onWrite(event => {
// all records after the last continue to invoke this function
console.log(event.data.val());
console.log(event.data.numChildren());
});
Note: Avoiding looping through children elements is preferred in my case.