问题
Is the method onSnapshot of firestore triggered by any changes in subcollections?
What is the difference between db.firestore.collection('x'). onSnapshot
And db.firestore.collection('x').doc('y').collection('z'). onSnapshot
Are they equal????
回答1:
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.
来源:https://stackoverflow.com/questions/52309507/firestore-onsnapshot-does-it-work-for-subcollections