Reputation: 651
I am trying to model the following relationship in a single Dynamodb table.
User -> many to many -> Game
User -> many to many -> Group
In words:
I have identified the following access patterns:
The first three access patterns can be implemented using the adjacent list design pattern as below:
| Partition Key | Sort Key (GSI Partition Key) |
| ------------- | ----------------------------- |
| User-<ID> | Game-<ID> |
| User-<ID> | Group-<ID> |
Any recommendations on how to implement the last access pattern - list all games that are owned by members of a group?
Thanks.
Upvotes: 3
Views: 490
Reputation: 7669
Your last query, list all games owned by members of a group, is already possible, but it’s a 2-part query.
First, get a list of the users in the group, then list all of the games for all of those users. You may have some duplicates, which you can clean up in the data access layer of your application.
Upvotes: 1