发布于 2015-09-14 14:58:59 | 179 次阅读 | 评论: 0 | 来源: 网络整理

cursor.readPref()
参数:
  • mode (string) – Read preference mode
  • tagSet (array) – Optional. Array of tag set objects

Append the readPref() to a cursor to control how the client will route the query will route to members of the replica set.

The mode string should be one of:

The tagSet parameter, if given, should consist of an array of tag set objects for filtering secondary read operations. For example, a secondary member tagged { dc: 'ny', rack: 2, size: 'large' } will match the tag set { dc: 'ny', rack: 2 }. Clients match tag sets first in the order they appear in the read preference specification. You may specify an empty tag set {} as the last element to default to any available secondary. See the tag sets documentation for more information.

注解

You must apply cursor.readPref() to the cursor before retrieving any documents from the database.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务