wereHamster/mojo — Issue #4: Incompatibility with newer mongodb versions: catch findandmodify error
Author: hannesgassert
Created: 2011-11-28 14:53:25+00:00
State: open

When polling for new tasks it often happens that there's no matches for the find() part of findandmodify()

Older versions of the driver just returned `null`, newer return a `MongoError` with `errmsg`='No matching object found'. In order to make mojo work with recent versions of the driver we have to handle that case in the callback passed to `Connection.next()` inside `Worker.poll`. In JS:
```
if (err != null && err.errmsg !== 'No matching object found') {
this.emit('error', err);
}
````

Thanks! :)