I am having an issues with understanding does dynamoDb supports filtering by object properties nested in array. Example:
Consider that we have following table called "Street" where one item (row) in that table have following structure:
{
name: "Street name",
population: 20,
houses: 5,
people: [
{
first_name: "FName1",
last_name: "LName1",
... other person's properties
},
{
first_name: "FName2",
last_name: "LName2",
... other person's properties
},
{
first_name: "FName3",
last_name: "LName3",
... other person's properties
}
... etc
]
}
We can consider in this scenario that "name" is dynamodb prefix = which means that we can query based on the street name.
I am interested does dynamodb supports following logic: "Query based on street with specific name and filter it for the person with following specific name."
The result would be something like (whole point is to return only one person/object from array which match the filter)
{
name: "Street nameX",
population: 20,
houses: 5,
people: [
{
first_name: "FNameX",
last_name: "LNameX",
... other person's properties
}
]
}
Basically question is, can dynamoDb filter results after query based on the object properties nested in array.
Please make a note that I understand that I can achieve this with different table schema - but this example is used for simplicity and it is as it is - focusing question on 'does dynamoDB have support for something like this or not?'.
DynamoDB has many attractive features. For example, it can automatically scale to handle trillions of calls in a 24-hour period. It can be used as a key-value store or a document database, and it can handle complex access patterns much faster than a typical relational database.
A DynamoDB Set deserializes into an object with its array of items stored under the values property. If we want a Set to deserialize into an array, we'll need to add an unmarshalling step where we assign the values property instead of the deserialized set object itself.
For faster response times, design your tables and indexes so that your applications can use Query instead of Scan . (For tables, you can also consider using the GetItem and BatchGetItem APIs.)
You can not query only using a Sort Key. You need to specify a partition key to perform query operations. Else, you need to create a global secondary index or perform a scan operation.
Looks like this is still not supported (at least back then at 2014).
Filtering / Querying by the Contents of a List in DynamoDB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With