本文介绍了Firestore onSnapshot->它适用于子集合吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

子存储区的任何更改是否触发了firestore的onSnapshot方法?

Is the method onSnapshot of firestore triggered by any changes in subcollections?

之间有什么区别db.firestore.collection('x').onSnapshot

What is the difference between db.firestore.collection('x'). onSnapshot

和db.firestore.collection('x').doc('y').collection('z').onSnapshot

And db.firestore.collection('x').doc('y').collection('z'). onSnapshot

它们相等吗??

推荐答案

对在文档下组织的子集合的更改不算作对文档本身的更改.他们不会在该文档上触发快照事件.

A change to a subcollection organized under a document do not count as changes to the document itself. They will not trigger a snapshot event on that document.

侦听子集合与侦听顶级集合没有什么不同.在这两种情况下,侦听器都只会通过对该集合或子集合中的文档进行更改来触发.

Listening to a subcollection is not any different than listening to a top-level collection. In both cases, the listener will only be triggered by changes to documents within that collection or subcollection.

这篇关于Firestore onSnapshot->它适用于子集合吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 09:02