Mongo.getReadPrefTagSet()
On this page
MongoDB 5.0 is end of life as of October 2024. This version of the documentation is no longer
supported. To upgrade your 5.0 deployment, see the MongoDB 6.0 upgrade procedures.
Mongo.getReadPrefTagSet()
Returns: The current read preference tag set for the Mongo()
connection object.See Read Preference for an introduction to read preferences and tag sets in MongoDB. Use
getReadPrefTagSet()
to return the current read preference tag set, as in the following example:db.getMongo().getReadPrefTagSet() Use the following operation to return and print the current read preference tag set:
printjson(db.getMongo().getReadPrefTagSet());
Compatibility
This method is available in deployments hosted in the following environments:
MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
MongoDB Enterprise: The subscription-based, self-managed version of MongoDB
MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB