- Reference >
- JavaScript Methods >
- sh.moveChunk()
sh.moveChunk()¶
-
sh.
moveChunk
(collection, query, destination)¶ Parameters: - collection (string) – Specify the sharded collection containing the chunk to migrate.
- query – Specify a query to identify documents in a specific chunk. Typically specify the shard key for a document as the query.
- destination (string) – Specify the name of the shard that you wish to move the designated chunk to.
Moves the chunk containing the documents specified by the
query
to the shard described bydestination
.This function provides a wrapper around the
moveChunk
. In most circumstances, allow the balancer to automatically migrate chunks, and avoid callingsh.moveChunk()
directly.