There is no way to read from both the parent collection and the sub collection in one operation. Read always come from one (type of) collection, which is sometimes explained as "all reads in Firestore are shallow".
You can either:
SubCategory
collections in one go with a collection group query . The second approach performs fewer calls to the server, but has a higher chance of reading more documents than needed, if (for example) you may not want the SubCategory
collection from some documents.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.