I am trying to call the .forEach function in my Cloud functions and it even works, but it does not return what I need, I am trying to get the branch key and it just returns TRUE.
I cannot remove return from the second line (I think this is a mistake), because as soon as I remove it, an error appears.
return admin.database().ref('test/100').once('value').then(function(snapshot) {
return snapshot.forEach(function(childSnapshot) {
var childKey = childSnapshot.key;
return childKey;
});
}).catch(function(error) {
return 'error';
})
My databse:
"test" : {
"100" : {
"ineedthis" : {
"example" : "example"
},
},
}
Return:
True
I will be very grateful to everyone who helps.