Get an instance of AWS.DynamoDB.DocumentClient from the aws-sdk

In this example we'll model a comic book store. Accounts are uniquely identified by email. One account has many purchases. Notice how the .arc comments annotates the extra fields on the purchases table definition (#comicID and #price). DynamoDB tables only define a schema for keys. All other attributes are optional. Likewise these comments are not significant but they will help your future colleagues understand the schema intent.


get /

  email *String

  email *String

  comicID *String

  publisher *String

Accessing the data with DynamoDB.DocumentClient is slightly nicer than the lower level DynamoDB client because it returns rows unformatted by their underlying DynamoDB types.

let data = require('@architect/data')

let email = ''

let TableName = data._name('purchases')

let purchases = await data._doc.query({
  KeyConditionExpression: 'email = :email',
  ExpressionAttributeValues: {
    ':email': email

In the example above we query purchases by email to see all the comics they bought.

Next: get