DynamoDB: Get Unique Values (Guide w/ Code Examples)

Provided by Rafal Wilinski
To retrieve unique values from a DynamoDB table using the JavaScript SDK, you can use the queryor scan operations and set the Distinct parameter to true. This will return only the unique values for the specified attribute.
But the scan operation does not support Distinct parameter, instead, you can use the filterExpression to filter the unique values.
var params = { TableName: "myTable", Distinct: true, KeyConditionExpression: "#product = :product", ExpressionAttributeNames: { "#product": "product" }, ExpressionAttributeValues: { ":product": "myProduct" } }; dynamodb.query(params, function(err, data) { if (err) { console.log(err); } else { console.log(data); } });
Similar Code Examples
- DynamoDB: Get Random Item
- DynamoDB: Get Multiple Items
- DynamoDB: GetItem
- DynamoDB: Get By ID
- DynamoDB: Delete Table
- DynamoDB: Batch Get
- DynamoDB: Query Greater Than
- DynamoDB: Get Last 10 Records
- DynamoDB: Like
- DynamoDB: Bulk Insert
- DynamoDB Get in Typescript
- DynamoDB: Delete Multiple Items in Javascript
- DynamoDB: Delete All Items With Partition Key
- DynamoDB BatchWriteItem in Typescript
- DynamoDB: Query Group By
Dynobase is a Professional GUI Client for DynamoDB
First 7 days are on us. No strings attached.
Product Features
DynamoDB Tools
DynamoDB Info
© 2026 Dynobase