This version of the documentation is archived and no longer supported.



The split command creates new chunks in a sharded environment. While splitting is typically managed automatically by the mongos instances, this command makes it possible for administrators to manually create splits.

In most clusters, MongoDB will manage all chunk creation and distribution operations without manual intervention.


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.

Consider the following example:

db.runCommand( { split : "test.people" , find : { _id : 99 } } )

This command inserts a new split in the collection named people in the test database. This will split the chunk that contains the document that matches the query { _id : 99 } in half. If the document specified by the query does not (yet) exist, the split will divide the chunk where that document would exist.

The split divides the chunk in half, and does not split the chunk using the identified document as the middle. To define an arbitrary split point, use the following form:

db.runCommand( { split : "test.people" , middle : { _id : 99 } } )

This form is typically used when pre-splitting data in a collection.

split is an administrative command that is only available for mongos instances.

←   shutdown splitChunk  →