I am using a global secondary index to query my table and want to be able to filter the results based on other attributes (the SQL equivalent would be a WHERE clause)). Scanning allows me to do this, but is it possible with a query? What other approaches can I take?
var params = {
"IndexName": "City-index",
"KeyConditions": {
"City": {
"AttributeValueList": [{
"S": city
}],
"ComparisonOperator": "EQ"
}
},
"Limit": "100",
"TableName": "properties"
}
dynamoDB.query(params, function(err, data) {
if (err) {
console.log(err);
} else {
console.log(data);
}
});
Any other ideas on how I can create a TABLE to achieve:
Hash Key: propertyID (unique)
Range Key: createdAt (unique
Global Secondary Indexes: City
Global Secondary Indexes: State
I would like to be able to query the index and then filter on other attributes (bedrooms, bathrooms, etc.).
source
share