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 have searched existing issues to ensure the issue has not already been raised
Issue
Hello! 👋
I'm responsible for a codebase that uses a primary read preference for some queries and secondaryPreferred for others. We are adding an analytics node to our MongoDB cluster, however, and thus need to specify read preference tags when using secondaryPreferred to ensure that production application queries are not served by the analytics node.
I've looked in the MongoDB Node.js driver, and read preference tags appear to be supported with no caveats (GitHub / API documentation / documentation). However, reading the Mongoose documentation, it appears that read preference tags are marked as DEPRECATED in version 6+.
It looks like this "DEPRECATED" line was unintentionally added, I missed this during code review. @hasezoey what was the reason behind marking Aggregate.prototype.readtags param as deprecated here: 437b03a ?
Even without tags param, you can always use .read(new mongoose.mongo.ReadPreference(pref, tags)).
i dont know exactly why i added this anymore, but it may have something to do with typescript leading me to mquery when doing a Go to Definition on the Query.prototype.read, which has the following code:
Query.prototype.read=Query.prototype.setReadPreference=function(pref){if(arguments.length>1&&!Query.prototype.read.deprecationWarningIssued){console.error('Deprecation warning: \'tags\' argument is not supported anymore in Query.read() method. Please use mongodb.ReadPreference object instead.');Query.prototype.read.deprecationWarningIssued=true;}this.options.readPreference=utils.readPref(pref);returnthis;};
TL;DR: i likely just didnt properly check that i landed in the mongoose definition instead of the mquery definition of Query.prototype.read
vkarpov15
added
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
and removed
help
This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary
labels
Oct 24, 2023
Prerequisites
Issue
Hello! 👋
I'm responsible for a codebase that uses a
primary
read preference for some queries andsecondaryPreferred
for others. We are adding an analytics node to our MongoDB cluster, however, and thus need to specify read preference tags when usingsecondaryPreferred
to ensure that production application queries are not served by the analytics node.I've looked in the MongoDB Node.js driver, and read preference tags appear to be supported with no caveats (GitHub / API documentation / documentation). However, reading the Mongoose documentation, it appears that read preference tags are marked as
DEPRECATED
in version 6+.Since it is not a breaking change, only a deprecation, this does not seem to be mentioned in the "Migrating from 5.x to 6.x" guide. The PR that added
DEPRECATED
in the documentation (#12140) does not include a detailed description, either. People seem to be recommending using read preference tags in open issues as late as this March, too.Could anyone provide more information on why read preference tags are considered deprecated and what the timeline is for sunsetting them?
Thanks in advance.
The text was updated successfully, but these errors were encountered: