简体   繁体   中英

Most Recent Document from each CollectionGroup

How do I query the MOST RECENT DOCUMENT from each CollectionGroup in Cloud Firestore?

Just one document from each Collection in the Group, the most RECENT!

Just one document from each Collection in the Group, the most RECENT!

You cannot. When you are using a CollectionGroup query, you are retrieving all documents that exist in all collections that have a specific name. If two of the most recent documents exist within the same collection/subcollection, both will be retrieved. You cannot tell Firestore to get a single document from within each collection, unless you create a separate query for each one of them and use a limit(1) call.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM