【发布时间】:2021-06-27 06:10:09
【问题描述】:
我需要来自下面的 firestore 查询的等效 firebase 实时数据库查询
await db.collection('Events')
.where('EventName', '>=', 'startcode')
.where('EventName', '<', 'endcode').get()
.then((snapshot) => {
snapshot.forEach(doc => {
const data = doc.data()
searchList.push(data)
})
})
【问题讨论】:
-
不幸的是,使用 Firebase 实时,您无法堆叠查询。您必须使用其中一个查询 firebase.google.com/docs/reference/js/firebase.database.Query 但是。您必须根据您的应用程序执行剩余的过滤客户端或服务器端。
-
嘿@johnnoula,如果我的回答对您有帮助,您可以通过单击对勾和向上箭头图标来接受/投票,否则请随时提出进一步的问题。
-
@sychordCoder 实时数据库确实允许working with lists
-
@Dharmaraj 明白我想指出的是,您不能堆叠相同的查询,措辞不佳。
标签: firebase firebase-realtime-database google-cloud-firestore