aheckmann/mquery — pull request #26 by ashtuchkin (2014-01-16 05:07:15+00:00)
Title: Remove mongodb driver dependency.

See more discussion in #25.

mongodb.ObjectId class was needed to clone existing ObjectId. Now we just use
obj.constructor of the old ObjectId.

mongodb.ReadPreference is more difficult. It's used to create a readPreference
option in queries.

Our options are:
1. We could try to keep the same semantics and save this class on mquery
initialization, something like `mquery = require('mquery')(mongodb)`.
This is deemed too serious change for such a small cause.
2. We could try to get it from a collection, but 1) it seems that this class
is not exported by collection and 2) this would violate the collection
abstraction infrastructure of mquery (lib/collection folder).
3. As mongo driver accepts both string representation of read preference and
an instance of ReadPreference class, we could work with just strings. This
way, user can keep using short string representation when the tags are not
needed (in majority of cases), and provide an instance of ReadPreference
class when tags are required. It's also future-proof as mongo driver can
add other options to ReadPreference class and users will be able to use
them right away. This last option is implemented.