firestore-聆听整个收藏集的更新 [英] firestore - listen to update on the entire collection

查看:107
本文介绍了firestore-聆听整个收藏集的更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google的Firestore,并且想对整个收藏进行实时更新.

I'm using google's firestore and I want to get a live update on the entire collection.

我在文档中看到了这一点: https://cloud.google.com/nodejs/docs /reference/firestore/0.11.x/CollectionReference#onSnapshot

I saw this in the documents: https://cloud.google.com/nodejs/docs/reference/firestore/0.11.x/CollectionReference#onSnapshot

但据我了解,我必须获取文档或查询一系列文档.

but as far as I understood I have to get a document or to query a range of documents.

我如何聆听整个收藏集中的变化?

how can I listen to changes in the entire collection?

推荐答案

如果您返回监听集合中的多个文档文档,只需省略where过滤器,您就应该获得整个集合.

If you refer back to the Listen to multiple documents in a collection documentation, simply omit the where filter and you should get the whole collection.

第一行如下所示:var query = db.collection("cities");

这篇关于firestore-聆听整个收藏集的更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆