You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was on an older version of mongoose and mongo driver (mongoose@3.6.4 & mongodb@1.2.14), and since upgrading to the newest version (mongoose@3.8.1 & mongodb@1.3.23) my read preference set on the collection level no longer seems to work. I also tried to set it on the query level, and it doesn't seem to work:
And same result, queries going to primary only. When I roll back to 3.6.4, reads start going to the secondaries (I'm setting the read preference on the collection).
The text was updated successfully, but these errors were encountered:
I have noticed the same thing. I believe it has to do with some of the createConnection() code that stores a flag as read_preference when it should be readPreference.
When I add the options to db under server options it works better.
e.g.
var options = {
// some other stuff
db : {
readPreference : "secondary"
}
};
To confirm the bug, I added a print statement in the code that searches for a machine to connect to. When only including in the url, the code uses a function called checkoutWriter() (part of mongo driver). When I add the setting above, it properly hits the checkoutReader() code.
I was on an older version of mongoose and mongo driver (mongoose@3.6.4 & mongodb@1.2.14), and since upgrading to the newest version (mongoose@3.8.1 & mongodb@1.3.23) my read preference set on the collection level no longer seems to work. I also tried to set it on the query level, and it doesn't seem to work:
Everything seems to be going to the primary. Rolling back to the old versions shows the expected behavior - queries going to the secondary.
I also tried to follow exactly the mongoose api docs:
And same result, queries going to primary only. When I roll back to 3.6.4, reads start going to the secondaries (I'm setting the read preference on the collection).
The text was updated successfully, but these errors were encountered: