Currently I am doing a forEach loop to populate the array based on user's favorites:
usersref.child(formData.openid + '/favorites').once('value', function(snapshot){
var favlist = [];
snapshot.forEach(function(fav){
fav = fav.key();
ref.child(fav).once('value',function(snapshot){
favlist.push(snapshot.val());
});
});
response.writeHead(200, {'Content-Type': 'application/javascript'});
response.write(favlist);
response.end();
});
usersref
is a the database for the user, ref
is the database for the items. formData.openid
is user's unique id.