(daleharvey/pouchdb#1199) - query() supports keys (rebased on #9)

The query() function now supports keys as an input param.
Keys are hashed in advance, to ensure that the complexity
is O(n) rather than O(n * m), where n is numDocs and m
is numKeys.

Since there are a lot of edge cases for null/undefined/etc.,
I'm also adding unit tests to daleharvey/pouchdb, which
confirm that the functionality is exactly like CouchDB's.