Answer the question
In order to leave comments, you need to log in
How to get the id of a child in firebase without knowing the parent?
I am using firebase realtime database on node.js .
The data structure is as follows:
{
...
batch-1:
id-1(Условно):
name:...
phone:...
id-2:
...
id-3:
...
batch-2:
...
batch-3:
...
...
batch-n:
...
}
let ref = admin.database().ref('batches/batch-1/id-1');
ref.on('value', (snapshot) => res.json(Object.assign({}, snapshot.val())));
let ref = admin.database().ref('batches/');
ref.child().orderByKey().equalTo('1').on('value', (snapshot) => res.json(Object.assign({}, snapshot.val())));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question