dresende/node-orm2 — pull request #12 by ccowan (2012-12-18 04:15:47+00:00)
Title: Add Comparison Operator to Conditions for the Model.find() method

The current find implementation is limited to doing equality testing only for select/find queries. This patch will allow the user to use other comparisons besides `=`. I wasn't sure what to name the comparison attribute. I went back and forth with either `op` or `operator` or `comp` or `comparison`; finally I just implemented all of them.

### Use Case

Imagine you need to build an endpoint for validating whether an email address is taken or not for a user profile page. The end point would need to validate if the new email address is taken by anyone other then the user requesting it.

```javascript

Users.find({ email: 'test@example.com', id: { value: 1, comparison: '<>' }}, function (err, users) {
if (err) {
// do something interesting
}

if (users.length === 0) {
// email is available
} else {
// email is not available
}
});

```