My data is as follows:
[
{
orgId: "ABC",
categories: [
"music",
"dance"
]
},
{
orgId: "XYZ",
categories: [
"math",
"science",
"art"
]
},
...
]
I have the primary key on orgId
, and I want to use DynamoDB query
to filter and return only items with category "science," for example.
(Category does not need to be part of any index: I am willing to accept the additional worker overhead, provided that I can do the query within Dynamo itself.)
I am having a dickens of a time getting this working. I can readily change categories
into nested objects if that would help?
But the comparison operators are so limited in DynamoDB that it appears there is no way to filter by array elements, or nested objects?
If not, what's the better approach here? To turn each category into its own first level attribute, such as:
[
{
orgId: "XYZ",
category_math: true,
category_science: true
}
]
Surely not?