Splits a chunk in a sharded cluster into two
chunks. The mongos instance splits and manages
chunks automatically, but for exceptional circumstances the
split command does allow administrators to manually
create splits. See Split Chunks in a Sharded Cluster for
information on these circumstances, and on the MongoDB shell commands
that wrap split.

The name of the collection where the chunk exists.
Specify the collection’s full namespace, including the
database name.

find

document

An query statement that specifies an equality match on the shard
key. The match selects the chunk that contains the specified
document. You must specify only one of the following: find,
bounds, or middle.

You cannot use the find option on an empty collection.

bounds

array

New in version 2.4: The bounds of a chunk to split. bounds
applies to chunks in collections partitioned using a hashed
shard key. The parameter’s array must consist of two documents
specifying the lower and upper shard-key values of the chunk. The
values must match the minimum and maximum values of an existing
chunk. Specify only one of the following: find, bounds, or
middle.

You cannot use the bounds option on an empty collection.

middle

document

The document to use as the split point to create two chunks.
split requires one of the following options: find,
bounds, or middle.

When used with either the find or the bounds option, the
split command splits the chunk along the median. As such,
the command cannot use the find or the bounds option to split
an empty chunk since an empty chunk has no median.

To create splits in empty chunks, use either the middle option with
the split command or use the splitAt command.

To create a split for a collection that uses a hashed shard key,
use the bounds parameter. Do not use the middle parameter for
this purpose.

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.

The split command identifies the chunk in the people
collection of the test database, that holds documents that match {_id:99}. split does not require that a match exist, in order
to identify the appropriate chunk. Then the command splits it into two
chunks of equal size.

Note

split creates two equal chunks by range as
opposed to size, and does not use the selected point as a boundary for
the new chunks

The split command identifies the chunk in the people
collection of the test database, that would hold documents
matching the query {_id:99}. split does not
require that a match exist, in order to identify the appropriate
chunk. Then the command splits it into two chunks, with the matching
document as the lower bound of one of the split chunks.

This example uses the hashed shard keyuserid in a
people collection of a test database. The following command
uses an array holding two single-field documents to represent the
minimum and maximum values of the hashed shard key to split the chunk: