Skip to content

Latest commit

History

146 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Mongorito Build Status

Awesome ES6 generator-based MongoDB ODM for Node.js v4.x (or newer). Just take a look on its pretty models and beautiful API. Uses monk under the hood.




Features

  • Based on ES6 generators, which means no callbacks
  • Established API you've already used to
  • Hooks (before:save, around:create, after:remove, etc)
  • Very simple and easy-to-understand implementation
  • Fully covered by tests
  • Using this module results in a beautiful code

Installation

$ npm install mongorito --save

Note: In order for the following examples to work, you need to use co to run generators.

Usage

constMongorito=require('mongorito');constModel=Mongorito.Model;// connect to localhost/blogMongorito.connect('localhost/blog');// define modelclassPostextendsModel{}// create and save new Post documentletpost=newPost({title: 'Node.js with --harmony rocks!',body: 'Long post body',author: {name: 'John Doe'}});yieldpost.save();// update documentpost.set('title','Post got a new title!');post.set('author.name','Doe John');yieldpost.save();// find posts where body equals "Long post body"letposts=yieldPost.where('body','Long post body').find();// find posts where author's name equals "John Doe"posts=yieldPost.where('author.name','John Doe').find();// Bonus: find posts where title starts with "Node"posts=yieldPost.where('title',/^node/i).find();

API

Check out Getting Started guide on http://mongorito.com. There are more guides available to learn more.

Tests

Build Status

$ make test

License

Mongorito is released under the MIT License.

About

ES6 generator-based MongoDB ODM for Node.js. It rocks.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages