DynamoDB: Query Items (Guide w/ Code Examples)
Provided by Rafal Wilinski
You can use the query
operation to query items using the AWS JavaScript SDK. It takes in several parameters, including the table name, an object that defines the query, and a callback function to handle the query results.
Here is an example of how to query items from a DynamoDB table called myTable
where the id
attribute is equal to a specific value:
var AWS = require('aws-sdk'); var dynamoDb = new AWS.DynamoDB.DocumentClient(); var params = { TableName: "myTable", KeyConditionExpression: "id = :idValue", ExpressionAttributeValues: { ":idValue": "someIdValue" } }; dynamoDb.query(params, function(err, data) { if (err) { console.log(err); } else { console.log(data); } });
Similar Code Examples
- DynamoDB: Get Multiple Items
- DynamoDB: Create if Not Exists
- DynamoDB: Get Last 10 Records
- DynamoDB: Bulk Insert
- DynamoDB: Get Last Inserted Item
- DynamoDB: Query Ends With
- DynamoDB Get in Typescript
- DynamoDB: Get Table
- DynamoDB BatchWriteItem in Typescript
- DynamoDB: Like
- DynamoDB: Increment Counter
- DynamoDB: Delete Table
- DynamoDB: Get Unique Values
- DynamoDB: Delete All Items With Partition Key
- DynamoDB: Get By ID
Tired of switching accounts and regions? Use Dynobase.
First 7 days are. No credit card needed.
Product Features
DynamoDB Tools
DynamoDB Info
© 2024 Dynobase