0

Application: AWS AppSync Database: DynamoDB Auth: Cognito

Partition Key: Id Sort Key: Id

Goal: Return a collection of records where the sort key matches one of the values in an array of strings.

The partition key and sort key are used to organize parent/child relationships between content. Root records have a generic Partition Key, which allows me to easily locate root records. Example:

PK: root SK: id0001

PK: root SK: id0002

PK: id0001 SK: id0003

There are obviously other properties, but this demonstrates how I can quickly query for root records (anything with PK of root) or any children of a specific parent record (PK = parent id).

I want to pass the following array: ["id0001", "id0002"] ...and have it query for all root records where the SK contains one of the array values.

1) I tried using contains in the query expressions, which generates an error. Apparently contains can only be used in filters. 2) I tried moving the contains logic to a filter, which generates an error. Apparently I can't filter on sort keys within a filter.

Any assistance is greatly appreciated.

4

0 回答 0