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 4.0.1
This release fixes a bug related to >= 10 conditions when querying or scanning.
Please comment or contact me if you have any questions about this release.
Bug Fixes
- Fixes issue where >= 10 conditions when querying or scanning would lead to an error
Documentation
- Adding community page to website