Just a simple ORM of MongoDB API.
CoffeeScript
Latest commit 601ac4e Jan 20, 2016 @jysperm Prepare 0.3.5

README.md

Mabolo

Just a simple ORM of MongoDB API.

这个东西还是非常好的嘛!—— Master Yeechan
和 Mongoose 各有千秋。—— orzFly

Travis-CI NPM Version NPM Downloads

Features

Define Schema and validate document

User = mabolo.model 'User',
  username:
    type: String
    required: true

  age:
    type: Number
    default: 18

  password: String

Define model methods and document methods

User.findByName = (name, options...) ->
  return @findOne name: name, options...

User::getName = ->
  return @username

Support embedded document or array

Token = mabolo.model 'Token',
  code: String

User = mabolo.model 'User',
  tokens: [Token]

Promise style and callback style API

User.create
  name: 'jysperm'
.then (jysperm) ->

User.create
  name: 'jysperm'
, (err, jysperm) ->

Modify document atomically

jysperm.modify (jysperm) ->
  Q.delay(1000).then ->
    jysperm.age = 19
.then ->