Query DynamoDB like MongoDB. A lightweight JSON model that simplifies DynamoDB's obscure query operations. It retains all original parameters and supports DynamoDB versions and future upgrades.
- Query condition is JSON format
- No need to consider complex expressions no matter query or update
- Column names can be any reserved keywords
- Return the correct int, float, number types
Create, modify, and drop DynamoDB tables
npm i dynamobase
yarn add dynamobase
import { dynamobase_config } from "dynamobase";
dynamobase_config({ region: "us-east-1" })
import { get_first, get_item, get_items } from "dynamobase";
const result = await get_first({
TableName: "table_name",
query: { _id: "xxxx-xxxx" },
ScanIndexForward: false,
});
All "GET" operations support: = | <= | < | >= | > | begins_with | between
Name | Type | Example | description |
---|---|---|---|
query | dict | {"id": 123} | query must be primary key (and sort key) |
Name | Type | description |
---|---|---|
query | dict | query can be primary key or GSI columns |
filter | dict | any fields and any values |
IndexName | String | required if query is GSI or LSI |
Select | String | |
AttributesToGet | List | |
Limit | int | |
ConsistentRead | String | |
KeyConditions | dict | |
QueryFilter | dict | |
ConditionalOperator | String | |
ScanIndexForward | boolean | |
ExclusiveStartKey | dict | |
ReturnConsumedCapacity | String | |
ProjectionExpression | String | |
FilterExpression | boto3.dynamodb.conditions.Attr |
Name | Type | Example |
---|---|---|
Item | dict | {"id": 123} |
Name | Type | Example | description |
---|---|---|---|
query | dict | {"id": 123} | query must be primary key (and sort key) |
Item | dict | {"field": "some value"} | -- |
Name | Type | Example | description |
---|---|---|---|
query | dict | {"id": 123} | query must be primary key (and sort key) |