Dynamorm

Dynamorm

  • Guide
  • API

›API

Guide

  • Introduction
  • Quick Start

API

  • Model
  • Query

Query

Intro

DynamoDB is very different from conventional RDS in many regards.
in order to use DynamoDB at it's best form, understanding the core concept of DynamoDB rather than blindly trying replicate the design patterns from RDS is crucial.
for this, DynamoDB Guide did fantastic job, we recommend to read it
on this chapter, we'll focus example of actual of "query" - retriving records from DynamoDB.

There are 5 different types of queryable enttiy in Dynamorm
But DynamoDB query patterns are identical, based on key type (Hash or Hash + Range)
In Dynamorm, we use the term "Hash" and "Full" for those.

EntityData Structure
HashPrimaryKeyHash
FullPrimaryKeyHash + Range
LocalSecondaryIndexHash (Same with PK) + Range
HashGlobalSecondaryIndexHash (Can be different with PK)
FullGlobalSecondaryIndexHash + Range (both can be different with PK)

So for example, FullPrimaryKey and FullGlobalSecondaryIndex has almost identical query interface, except few APIs

HashPrimaryKey

.get(hashKey: HashKeyType, options: { consistent: boolean }): Promise<T | null>

find single record with hashKey, return null if record not exists
if the record is < 4KB, consumes 1 read capacity.

.scan(options)

(TBD)

.batchGet(hashKeys)

(TBD)

.batchGetFull()

(TBD)

FullPrimaryKey

.get(hashKey, sortKey, options)

(TBD)

.batchGet(keys)

(TBD)

.batchGetFull(keys)

(TBD)

.query(options)

(TBD)

.scan(options)

(TBD)

LocalSecondaryIndex

Identical to FullPrimaryKey

HashGlobalSecondaryIndex

Identical to HashPrimaryKey

FullGlobalSecondaryIndex

Identical to FullPrimaryKey

← Model
  • Intro
  • HashPrimaryKey
    • .get(hashKey: HashKeyType, options: { consistent: boolean }): Promise<T | null>
    • .scan(options)
    • .batchGet(hashKeys)
    • .batchGetFull()
  • FullPrimaryKey
    • .get(hashKey, sortKey, options)
    • .batchGet(keys)
    • .batchGetFull(keys)
    • .query(options)
    • .scan(options)
  • LocalSecondaryIndex
  • HashGlobalSecondaryIndex
  • FullGlobalSecondaryIndex
    • .update(hashKey, sortKey, changes)
    • .batchDelete(keys) -->
Dynamorm
Docs
Getting StartedAPI Reference
More
GitHubStar