I'm new to DynamoDB (and to noSQL in general) and am struggling a little to get my head round some of the concepts. One thing in particular is giving me some problems, which is around querying a table based on a boolean key.
I realize that I can't create a primary or secondary index on a boolean key, but I can't see how I should ideally index and query a table with the following structure;
reportId: string (uuid) reportText: string isActive: boolean category: string
I would like to be able to complete the following searches:
- Access a specific report directly (a primary hash index of
- List reports of a specific category (a primary hash index on
These are both straightforward, but I would like to perform two other queries;
- List all reports that are marked as isActive = true
- List all reports of a specific category that are marked as isActive
My first approach would be to create a primary hashkey index on
isActive, with a rangekey on
category, but I'm only able to choose
Binary as the attribute type.
isActive as a string (saved as 'true' rather than a boolean true) solves the problem, but its horrible using a string for a boolean property.
Am I missing something? Is there a simple way to query the table directly on a boolean value?
Any advice duly appreciated.
Thanks in advance.