更新时间:2023-02-14 09:58:47
QuerySnapshot
指向多个 QueryDocumentSnapshot
实例.
从 QueryDocumentSnapshot
,你可以得到它的集合:
From a QueryDocumentSnapshot
, you can get the collection it's from with:
snapshot.getRef().getParent()
然后父 DocumentReference
是:
snapshot.getRef().getParent().getParent()
所以要获得父文档的子集合:
So to get a subscollection of the parent document with:
snapshot.getRef().getParent().getParent().collection("name_of_subcollection")
是的,我同意……这本来可以更具可读性.:)
Yes, I agree... that could've been a bit more readable. :)