Currently it is only possible to get a subcollection from a single document:
class UserStats(AsyncSubModel):
id: Optional[str]
purchases: int = 0
class Collection(AsyncSubCollection):
# Can use any properties of the "parent" model
__collection_tpl__ = "users/{id}/stats"
class User(AsyncModel):
__collection__ = "users"
name: str
async def get_user_stats(user_id):
user = await User.get_by_id(user_id)
stats_model: Type[UserStats] = UserStats.model_for(user)
Ideally, the ability to query all user stats (as supported by firestore's group query):
Currently it is only possible to get a subcollection from a single document:
Ideally, the ability to query all user stats (as supported by firestore's group query):
Side note: It would be awesome to not have to retrieve the user before querying its subcollection
or