dynobase-icon
Dynobase

DynamoDB: Not Between (Guide w/ Code Examples)

Rafal Wilinski

Provided by Rafal Wilinski

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); }); } });

Better DynamoDB experience.

Try 7-day free trial. No credit card needed.

Product Features

Download
/
Changelog
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2024 Dynobase
+
Login to the AWS Console less.
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.