dresende/node-orm2 — pull request #134 by dresende (2013-04-19 18:39:53+00:00)
Title: Adds support for chaining and rechaining with ChainFind

As pointed out by @dxg in #131 , this might be a very good feature.

An example (similar to the test file in this pull request):

```js
var Person = db.define('person', {
// ...
});

Person.onlyAdmins = function () {
return this.find({ admin : true });
};
Person.fromCountry = function (country) {
return this.find({ country : country });
};

Person.onlyAdmins().fromCountry("India").run(function (err, people) {
// people with admin = true and country = "India"
});
```

The `this.find` used in the first 2 functions is actually a function of the `ChainFind` that for now only accepts conditions but other stuff can be added. Also, when a new `ChainFind` instance is created, the methods added to `Person` are also linked to the chain. That's why it's possible to chain more than one method, otherwise chaining only one method was already possible.