Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DynamoDB nested query support

Does Amazon DynamoDB scan operation allow you to query on nested attributes of type Array or Object? For example,

{     Id: 206,     Title: "20-Bicycle 206",     Description: "206 description",     RelatedItems: [         341,          472,          649     ],     Pictures: {         FrontView: "123",          RearView: "456",         SideView: "789"     } } 

Can I query on RelatedItems[2] or Pictures.RearView attributes?

like image 667
Hiren Avatar asked Aug 26 '15 19:08

Hiren


People also ask

Does DynamoDB support nested objects?

In addition to simple data types like numbers and strings DynamoDB supports these types: Nested object: A value of an attribute in DynamoDB can be a complex nested object.

Does DynamoDB support Query?

You now can use a SQL-compatible query language to query, insert, update, and delete table data in Amazon DynamoDB. You now can use PartiQL (a SQL-compatible query language)—in addition to already-available DynamoDB operations—to query, insert, update, and delete table data in Amazon DynamoDB.

Which one of the following data types does Amazon DynamoDB not support?

Unlike conventional relational databases, DynamoDB does not natively support a date and time data type. It can be useful instead to store data and time data as a number data type, using Unix epoch time.

What does the Query operation in Amazon DynamoDB allow you to do?

The Query operation allows you to limit the number of items that it reads. To do this, set the Limit parameter to the maximum number of items that you want. For example, suppose that you Query a table, with a Limit value of 6 , and without a filter expression.


1 Answers

Yes, you can use a Filter Expression, which is just like Condition Expression. The section that talks about the functions that you can use in these types of expressions mentions the following:

"For a nested attribute, you must provide its full path; for more information, see Document Paths."

The Document Paths reference has examples on how to reference nested attributes in DynamoDB data types like List (what you are calling an array) and Map (what you are calling an object). Check out that reference for examples on how to do so:

  • MyList[0]
  • AnotherList[12]
  • ThisList[5][11]
  • MyMap.nestedField
  • MyMap.nestedField.deeplyNestedField
like image 178
readyornot Avatar answered Sep 24 '22 05:09

readyornot