DynamoDB: Not Between (Guide w/ Code Examples)
The AWS JavaScript SDK does not have a method for performing a "not between" query on a table. However, you can use the query
operation to retrieve items where the value of a specific attribute is less than a given value and greater than another given value.
const params = { TableName: "myTable", KeyConditionExpression: "#age between :minAge and :maxAge", ExpressionAttributeNames: { "#age": "age" }, ExpressionAttributeValues: { ":minAge": 20, ":maxAge": 30 } }; dynamodb.query(params, function(err, data) { if (err) { console.error("Unable to query. Error:", JSON.stringify(err, null, 2)); } else { console.log("Query succeeded."); data.Items.forEach(function(item) { console.log(" -", item.age + ": " + item.info); }); } });
Similar Code Examples
- DynamoDB: Attribute Not Null
- DynamoDB: Delete Table
- DynamoDB: Get By ID
- DynamoDB: Query Group By
- DynamoDB: Delete Multiple Items in Javascript
- DynamoDB: Get List Of Items
- DynamoDB: Batch Get
- DynamoDB: BatchGetItem
- DynamoDB: Like
- DynamoDB: Get Last Inserted Item
- DynamoDB: Not Begins With
- DynamoDB: Get Unique Values
- DynamoDB: Query Count
- DynamoDB: Query Global Secondary Index in Nodejs
- DynamoDB: Bulk Insert
Better DynamoDB experience.
First 7 days are on us. No strings attached.
Product Features
DynamoDB Tools
DynamoDB Info
© 2023 Dynobase