szu
szu

Reputation: 972

Get count from DynamoDB resolver

Is there a way to get count of items returned by DynamoDB query from AppSync API?

DDB projection COUNT is not supported in AppSync, also I can't write something like ${context.result.items.count} in response mapping.

Upvotes: 2

Views: 1117

Answers (1)

szu
szu

Reputation: 972

Quick workaround (will not work for 1MB+ results): define scalar return value for the query in schema and use in response resolver $util.toJson($ctx.result.items.size())

Upvotes: 1

Related Questions