1.0.0 • Published 4 years ago

bearded-monk v1.0.0

Weekly downloads
3
License
GPL-3.0-or-later
Repository
github
Last release
4 years ago

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    : 'foo@example.com'
})

u.save().then(() => {
	User.findOne({name: 'Foo'}).then((doc) => {
		console.log(doc)
	})
})

Docs