翻译或纠错本页面
- Reference >
- mongo Shell Methods >
- 分片方法 >
- sh.moveChunk()
sh.moveChunk()¶
On this page
Definition¶
- sh.moveChunk(namespace, query, destination)¶
Moves the chunk that contains the document specified by the query to the destination shard. sh.moveChunk() provides a wrapper around the moveChunk database command and takes the following arguments:
Parameter Type Description namespace string The namespace of the sharded collection that contains the chunk to migrate. query document An equality match on the shard key that selects the chunk to move. destination string The name of the shard to move.
参见
moveChunk, sh.splitAt(), sh.splitFind(), 分片, and chunk migration.
Example¶
Given the people collection in the records database, the following operation finds the chunk that contains the documents with the zipcode field set to 53187 and then moves that chunk to the shard named shard0019:
sh.moveChunk("records.people", { zipcode: "53187" }, "shard0019")