-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different mongo driver versions in mquery vs mongoose #25
Comments
yeah I think there's another issue open related to this. might be nice to support passing in an ObjectId constructor and optionally a ReadPref constructor. then we don't have any direct dependency |
pull request? |
ashtuchkin
added a commit
to ashtuchkin/mquery
that referenced
this issue
Jan 16, 2014
See more discussion in mongoosejs#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.
ashtuchkin
added a commit
to ashtuchkin/mquery
that referenced
this issue
Jan 16, 2014
See more discussion in mongoosejs#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.
ashtuchkin
added a commit
to ashtuchkin/mquery
that referenced
this issue
Jan 16, 2014
See more discussion in mongoosejs#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.
Fixed in #26. Closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As of now, we have the following versions:
As you can see,
mongoose@3.8.4
requiresmongodb@1.3.23
, andmquery@0.4.1
which itself requiresmongodb@1.3.19
. Two versions of mongodb driver are loaded, which is +150ms to startup time and a source of magic incompatibility errors.Keeping versions in sync would help, but is prone to forgetting, etc. Maybe it's better to provide external mongodb driver reference to the mquery before use, i.e.:
The text was updated successfully, but these errors were encountered: