Docs Menu

splitChunk

On this page

  • Definition
splitChunk

An internal administrative command. To split chunks, use the sh.splitFind() and sh.splitAt() functions in mongosh.

Warning

Be careful when splitting data in a sharded collection to create new chunks. When you shard a collection that has existing data, MongoDB automatically creates chunks to evenly distribute the collection. To split data effectively in a sharded cluster you must consider the number of documents in a chunk and the average document size to create a uniform chunk size. When chunks have irregular sizes, shards may have an equal number of chunks but have very different data sizes. Avoid creating splits that lead to a collection with differently sized chunks.

Tip
See also:

The splitChunk command takes a document with the following fields:

Field
Type
Description
ns
string
The complete namespace of the chunk to split.
keyPattern
document
min
document
The lower bound of the shard key for the chunk to split.
max
document
The upper bound of the shard key for the chunk to split.
from
string
The shard that owns the chunk to split.
splitKeys
document
The split point for the chunk.
shardId
document
The shard.
←  splitsplitVector →

On this page

Give Feedback
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.