sh.splitFind()

Definition

  • sh.splitFind(namespace, query)
  • Splits the chunk that contains the shard key value specified by thequery at the chunk’s median point. sh.splitFind()creates two roughly equal chunks. To split a chunk at a specificpoint instead, see sh.splitAt().

The method takes the following arguments:

ParameterTypeDescriptionnamespacestringThe namespace (i.e. <database>.<collection>) of the shardedcollection that contains the chunk to split.querydocumentA query document that specifies the shard key valuethat determines the chunk to split.

The sh.splitFind() method wraps the splitcommand.

Consideration

In most circumstances, you should leave chunk splitting to theautomated processes within MongoDB.

To use sh.splitFind(), the sharded collection must bepopulated.

Example

For the sharded collection test.foo, the following example splits,at the median point, a chunk that contains the shard key value x:70.

  1. sh.splitFind( "test.foo", { x: 70 } )