2.2 新版功能.
| 参数: |
|
|---|
sh.addTagRange() attaches a range of values of the shard key to a shard tag created using the sh.addShardTag() method. Use this operation to ensure that the documents that exist within the specified range exist on shards that have a matching tag.
Always issue sh.addTagRange() when connected to a mongos instance.
Example
Given a shard key of {STATE:1,ZIP:1}, create a tag range covering ZIP codes in New York State:
sh.addTagRange( "exampledb.collection",
{STATE: "NY", ZIP: {minKey:1}},
{STATE:"NY", ZIP: {maxKey:1}},
"NY"
)