Skip to content
Advertisement

What is the proper syntax to get() entries where the sort key begins with a substring using AWS.DynamoDB.DocumentClient in NodeJS?

What is the proper syntax to query database entries whose sort key starts with a specific string?

I believe it’s something along the lines of

JavaScript

Followed by a dynamoDb.get(query_params, ..., but that is not quite right. I am getting an ValidationException: The provided key element does not match the schema error.

Advertisement

Answer

According to the SDK query documentation, your query params should look like this

JavaScript

You’ll also need to change dynamoDb.get() to dynamoDb.query().

Advertisement