Mongorito

MongoDB ODM for Node.js based on ES6 generators.

No callbacks or promises.

1
2
3
4
5
6
7
  var post = new Post({
  	title: 'Node.js with --harmony rocks!'
  });

  yield post.save();

  var posts = yield Post.limit(5).find();

Features

No callbacks very cool

Mongorito is based on ES6 generators, so you will not need to write a single callback (or promise). Enjoy the comfort of writing synchronous code, while retaining the power of Node.js' async nature.

Common and established API

Mongorito does not re-invent the wheel. Take a look at the code example above, same principles as in ActiveRecord, Mongoose and others. Learning curve is so low, you'll forget when you opened the docs last time.

Middleware

Yes, like in Express and Koa. Put functions before or after CRUD methods and control the flow. Modify data, abort the operation and everything else I could not think of.

No Schema

That's right, no schema. One of the best MongoDB strengths is that it's totally schema-less. Mongorito does not want to take that feature away from you. Just use get and set methods and everything will go smooth.

Query population

Mongorito borrowed that idea from the awesome Mongoose. Population allows replacing ObjectID's in query response with actual documents from other collections.

Full test coverage

Every bit of Mongorito's functionality is tested. Just as main codebase, tests are easy to read and understand. If you don't believe it, check it yourself by running npm test after cloning the repository.

Multiple database support new

Mongorito supports multiple database connections at the same time. Every model can have different database connection and API stays the same. All models that don't have custom connection, use the global default.

More features coming soon. Open a github issue if you have suggestions.

Try it out!

Mongorito is very easy to learn and a pleasure to work with. To get you started, I wrote a quick tutorial, where you will manage posts for a blog. There are also non-boring guides available, if you decided to use Mongorito in your projects.

Make sure you've got Node.js v0.11.x or newer installed and program is executed with --harmony option. I recommend nvm or n to manage Node.js versions.

Show some

Yes, that's all it takes! Tweet, follow and star it on GitHub!