guileen/node-mongoskin — Issue #23: Catch findOne() exception when no match found
Author: henrypijames
Created: 2011-12-14 09:04:51+00:00
State: open

* Steps to reproduce: Use `findOne()` without callback for a query that finds no match, e. g. `db.myEmptyCollection.findOne()`
* Expected result: `findOne()` returns `null`, just like in the mongo shell
* Actual result: `findOne()` throws an exception that must be caught

This should be possible:
```javascript
function hasCollection(db, query) {return db.findOne(query) !== null}
```