dynobase-icon
Dynobase

DynamoDB: Get Query (Guide w/ Code Examples)

To query a table in Amazon DynamoDB using the JavaScript SDK, you can use the query method on the DynamoDB DocumentClient. The query method takes an object that specifies the parameters of the query.

const AWS = require('aws-sdk'); const dynamoDb = new AWS.DynamoDB.DocumentClient(); const params = { TableName: 'myTable', KeyConditionExpression: '#key = :value', ExpressionAttributeNames: { '#key': 'key', }, ExpressionAttributeValues: { ':value': 'value', }, }; dynamoDb.query(params, (err, data) => { if (err) { console.error('Error:', err); } else { console.log('Data:', data); } });

It is important to note that the query method will only return items with the specified primary key value, and the primary key must be specified in the KeyConditionExpression parameter.

Tired of switching accounts and regions? Use Dynobase.

First 7 days are. No credit card needed.

Product Features

Download
/
Changelog
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2023 Dynobase
+
Better DynamoDB Experience.
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.