I'm building an app using firebase and Node.js. I need to get data from nested foreach. How to do it correctly? Need to return the results of all iterations simultaneously.
exports.userParty = function (userInfo, cb) {
var userID = userInfo.userID;
var clubID = userInfo.clubID;
var refUserParty = ref.child(userID).child('my_party_id');
var party = {};
refUserParty.orderByValue().once("value", function (snapshot) {
    var party = {};
    snapshot.forEach(function (partyID) {
        var refParty = dbb.ref('clubs').child(clubID).child('party').child(partyID.val());
        refParty.once('value', function (partyBody) {
            party[partyID.val()] = partyBody.val();
            //console.log(party);
        });
    });
    cb(party); // {}
});
};
 
    