Docs HomeMongoDB Manual

Mongo.getReadPrefTagSet()

Mongo.getReadPrefTagSet()
Returns:返回:The current read preference tag set for the Mongo() connection object.Mongo()连接对象设置的当前读取首选项标记。

See Read Preference for an introduction to read preferences and tag sets in MongoDB. 有关MongoDB中读取首选项和标记集的介绍,请参阅读取首选项Use getReadPrefTagSet() to return the current read preference tag set, as in the following example:使用getReadPrefTagSet()返回当前的读取首选项标记集,如下例所示:

db.getMongo().getReadPrefTagSet()

Use the following operation to return and print the current read preference tag set:使用以下操作返回并打印当前读取首选项标记集:

printjson(db.getMongo().getReadPrefTagSet());