The Cloud Firestore ODM is currently in alpha. Expect breaking changes, API changes and more. The documentation is still a work in progress. See the discussion for more details.
The ODM provides support for subcollections via the
Collection annotation. For example, first define
the root collection as normal:
Let's assume each user document contains a subcollection containing user addresses. Firstly define the model for an address:
Next, define the path to the subcollection in a new
After code generation, we can now access the sub-collection via the
The subcollection reference has full access to the same functionality as root collections. To learn more about usage of references, see the using references documentation.