Features
- Simplified data modeling and mapping to DynamoDB types
- Advanced chainable apis for query and scan operations
- Data validation
- Autogenerating UUIDs
- Global Secondary Indexes
- Local Secondary Indexes
- Parallel Scans
You can configure vogels to automatically add createdAt and updatedAt timestamp attributes when saving and updating a model. updatedAt will only be set when updating a record and will not be set on initial creation of the model.
var Account = vogels.define('Account', {
hashKey : 'email',
// add the timestamp attributes (updatedAt, createdAt)
timestamps : true,
schema : {
email : Joi.string().email(),
}
});
var Account = vogels.define('Account', {
hashKey : 'email',
// enable timestamps support
timestamps : true,
// I don't want createdAt
createdAt: false,
// I want updatedAt to actually be called updateTimestamp
updatedAt: 'updateTimestamp'
schema : {
email : Joi.string().email(),
}
});
var Event = vogels.define('Event', {
hashkey : 'name',
schema : {
name : Joi.string(),
total : Joi.number()
},
tableName: 'deviceEvents'
});
var Event = vogels.define('Event', {
hashkey : 'name',
schema : {
name : Joi.string(),
total : Joi.number()
},
// store monthly event data
tableName: function () {
var d = new Date();
return ['events', d.getFullYear(), d.getMonth() + 1].join('_');
}
});
See more at examples https://github.com/ryanfitz/vogels/tree/master/examples
Read more at https://github.com/ryanfitz/vogels/
No comments:
Post a Comment