bearded-monk
v1.0.0
Published
A ultra fast and lightweight ORM MongoDB driver built on top of monk and joi, heavily inspired by Mongoose
Downloads
1
Readme
bearded-monk
A ultra fast and lightweight ORM MongoDB driver built on top of monk and joi, heavily inspired by Mongoose
Usage
const beardedMonk = require('bearded-monk')('mongodb://localhost/test')
const {Joi, model} = beardedMonk
const userSchema = Joi.object().keys({
name : Joi.string().alphanum().min(3).max(32).required(),
password : Joi.string().min(8),
email : Joi.string().email()
})
const User = model('User', userSchema)
const u = new User({
name : 'Foo',
password : 'superSecretPassword',
email : '[email protected]'
})
u.save().then(() => {
User.findOne({name: 'Foo'}).then((doc) => {
console.log(doc)
})
})