For or While with Javascript and Firebase Realtime Database

Viewed 14

Is this possible with Firebase and Javascript? I have a realtime Database which looks like this: P1

Now I want to get access to this database and copy these two parent string into an array. After that I want a for or while loop where this function below gets executed but one time with the first string and the second time with the second string.

This is the code:

var ref = db.ref('/user/' + >>Place String<< + '/notification/'+ subMessageID + '/subMessageID/').set(subMessageID);

The result should be the same as if I would have typed this:

var ref = db.ref('/user/' + 'PpRWBqHFYlg78vSeutNOAPMG3wv1' + '/notification/'+ subMessageID + '/subMessageID/').set(subMessageID);
var ref = db.ref('/user/' + 'hSzkimAs1fWgNke9stnQnf7cNyi2' + '/notification/'+ subMessageID + '/subMessageID/').set(subMessageID);

The path till notification is known. But I don't know how many strings are stored in notification. So it needs to get all of them.

I watched this tutorial here with while and for loops but they work with arrays.

0 Answers
Related