答案 0 :(得分:0)
由于firebase(与firestore不同)在查询方面相当剥离,一种方法是这样做:
的JavaScript :
const fetchRestaurants = async () => {
try {
const ids = ["id1", "id2", "id3"]
const promises = ids.map(id => firebase.database().ref('/Restaurants/'+id).once('value').then(snap => snap.val()))
const restaurants = await Promise.all(promises)
} catch(error) {
console.log("Error fetching restaurants", error)
}
}