Dynamoose is a modeling tool for Amazon's DynamoDB (inspired by Mongoose).
Dynobase helps you accelerate your DynamoDB workflow with code generation, faster data exploration, bookmarks and more: https://dynobase.dev/
Getting Started
Description
Dynamoose is a modeling tool for Amazon's DynamoDB. Dynamoose is heavily inspired by Mongoose, which means if you are coming from Mongoose the syntax will be very familiar.
Key Features
- Type safety
- High level API
- Easy to use syntax
- DynamoDB Single Table Design Support
- Ability to transform data before saving or retrieving items
- Strict data modeling (validation, required attributes, and more)
- Support for DynamoDB Transactions
- Powerful Conditional/Filtering Support
- Callback & Promise support
- AWS Multi-region support
Example
import * as dynamoose from "dynamoose";
import * as crypto from "crypto";
const Book = dynamoose.model("Book", {
"id": {
"type": String,
"hashKey": true,
"default": () => crypto.randomUUID()
},
"title": {
"type": String,
"required": true
},
"author": {
"type": String,
"required": true
},
"publishedDate": {
"type": Date,
"required": true
},
"genre": {
"type": String,
"required": true,
"enum": [
"fantasy",
"sci-fi",
"mystery",
"thriller",
"romance",
"non-fiction",
"horror",
"biography",
"autobiography",
"poetry",
"children's",
"young-adult",
"other"
]
},
"summary": String,
"pageCount": Number
});
const newBook = new Book({
"title": "Harry Potter and the Philosopher's Stone",
"author": "J.K. Rowling",
"publishedDate": new Date("1997-06-26"),
"genre": "fantasy",
"summary": "The story of a young wizard who discovers he is a wizard and attends a magical school.",
"pageCount": 223
});
await newBook.save();
const allBooks = await Book.scan().exec();
console.log(allBooks);
Resources
General
Social
Branch Strategy
Below you will find the current branch strategy for the project. Work taking place on the branches listed below might be further ahead than the versions on NPM. All documentation links found below will also be reflective of the published version on NPM. If you would like to live dangerously and run non-released versions, you can run npm install dynamoose/dynamoose#BRANCH
(replacing BRANCH
with the branch listed below). You will also find the most up-to-date documentation in the docs
folder of the branch.
Version 4.0.4
This release contains some minor fixes. It is highly recommended to upgrade to this version as soon as possible as it contains a vulnerability fix for a dependency.
Please comment or contact me if you have any questions about this release.
Bug Fixes
- Bump
@aws-sdk/client-dynamodb
& @aws-sdk/util-dynamodb
to v3.782.0
- Bump
js-object-utilities
to v2.2.1 (this contains a vulnerability fix)
Documentation
- Adds example code to README.md & website homepage
- Adds v3 documentation to website version dropdown
Other
- Enables npm provenance support to verify package integrity