What is dynamoose?
Dynamoose is a modeling tool for Amazon's DynamoDB, inspired by Mongoose. It provides a simple and easy-to-use API for defining schemas, models, and performing CRUD operations on DynamoDB tables.
What are dynamoose's main functionalities?
Schema Definition
Dynamoose allows you to define schemas for your DynamoDB tables. This schema definition helps in structuring the data and enforcing data types.
const dynamoose = require('dynamoose');
const UserSchema = new dynamoose.Schema({
id: String,
name: String,
age: Number
});
Model Creation
Once you have defined a schema, you can create a model. This model will be used to interact with the DynamoDB table.
const User = dynamoose.model('User', UserSchema);
CRUD Operations
Dynamoose provides methods for performing CRUD operations. You can create, read, update, and delete items in your DynamoDB table using the model.
const newUser = new User({
id: '1',
name: 'John Doe',
age: 30
});
newUser.save();
User.get('1').then(user => console.log(user));
User.update({ id: '1' }, { age: 31 });
User.delete('1');
Query and Scan
Dynamoose supports querying and scanning the DynamoDB table. You can use various conditions to filter the data.
User.query('name').eq('John Doe').exec().then(users => console.log(users));
User.scan('age').gt(25).exec().then(users => console.log(users));
Other packages similar to dynamoose
aws-sdk
The AWS SDK for JavaScript provides direct access to DynamoDB and other AWS services. It is more low-level compared to Dynamoose and requires more boilerplate code for operations.
vogels
Vogels is another DynamoDB modeling tool inspired by Mongoose. It offers similar functionalities to Dynamoose but is less actively maintained.
Version 3.2.0
This release fixes a lot of bugs and adds some nice to have features to make your Dynamoose experience even better.
Please comment or contact me if you have any questions about this release.
General
- Adds new
tableName
option to Model initialization settings. - Adds new
consistent
option to batchGet
. - Improving performance for models and tables with single schema.
Bug Fixes
- Using all indexes from all schemas in table.
- Fixed an issue where indexes would get recreated when table throughput is set to ON_DEMAND.
- Now using correct TypeScript array type for
query
and scan
operations when using toJSON()
.
Documentation
- Fixes Configuration documentation for
accessKeyId
& secretAccessKey
in AWS SDK v3. - Typo fixes in documentation.
- Fixed an issue where ESModules import statement documentation for non-TypeScript users was incorrect.
- Added Dynamoose Mastodon link to website.
Other
- Now requiring CLA to be signed for all pull request authors.
- Only including
dist
folder in npm package. - Updating dependencies.
- Removing support for Dynamoose v2 bug fixes.
- Added Node.js v19.x to CI test suite.