<section>
 <h1 class="contains-headerlink leafygreen-ui-41fr9s" weight="medium">
  Create Ranges in a Sharded Cluster
  <a class="headerlink leafygreen-ui-1kepx47" href="#create-ranges-in-a-sharded-cluster" title="Permalink to this heading">
   <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
    <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
    </path>
    <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
    </path>
   </svg>
   <div class="css-1btu0w3 evvkmar0" id="create-ranges-in-a-sharded-cluster">
   </div>
  </a>
 </h1>
 <div class="leafygreen-ui-a5yxub">
  <p class="css-1cmx2d4 ef7gu8j0">
   On this page
  </p>
  <ul class="css-1qb0mst ef7gu8j1">
   <li class="leafygreen-ui-1e7a0ei">
    <a class="lg-ui-0001 leafygreen-ui-e98ikf" href="#learn-more" target="_self">
     <span>
      Learn More
     </span>
    </a>
   </li>
  </ul>
 </div>
 <p class="leafygreen-ui-1kp3ins">
  In most situations a
  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/glossary/#std-term-sharded-cluster">
   sharded cluster
  </a>
  will create, split, and
distribute ranges automatically without user intervention. However, in
some cases, MongoDB cannot create enough ranges or distribute data fast
enough to support the required throughput.
 </p>
 <p class="leafygreen-ui-1kp3ins">
  For example, if you want to ingest a large volume of data into a cluster
where you have inserts distributed across shards, pre-splitting the
ranges of an empty sharded collection can improve throughput.
 </p>
 <div class="leafygreen-ui-15mdk4" role="note">
  <h2 class="leafygreen-ui-6n7b7d">
   Note
  </h2>
  <div class="leafygreen-ui-9mycqc">
   <p class="leafygreen-ui-1kp3ins">
    Starting in MongoDB 6.0, the balancer does not distribute empty
ranges. To pre-split the collection, use
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/moveRange/#mongodb-dbcommand-dbcmd.moveRange">
     <code class="leafygreen-ui-1l06pbn">
      moveRange
     </code>
    </a>
    to
distribute the empty ranges across the shards in the cluster.
    <code class="leafygreen-ui-1l06pbn">
     moveRange
    </code>
    automatically splits the range to be moved, meaning
    <code class="leafygreen-ui-1l06pbn">
     moveRange
    </code>
    performs both splitting and moving. You don't need to
manually split the range with
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/split/#mongodb-dbcommand-dbcmd.split">
     <code class="leafygreen-ui-1l06pbn">
      split
     </code>
     .
    </a>
   </p>
  </div>
 </div>
 <p class="leafygreen-ui-1kp3ins">
  Alternatively, by defining the
  <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/zone-sharding/">
   zones
and zone ranges
  </a>
  <em>
   before
  </em>
  sharding an empty or a
non-existing collection, the shard collection operation creates ranges
for the defined zone ranges as well as any additional ranges to cover
the entire range of the shard key values and performs an initial range
distribution based on the zone ranges. For more information, see
  <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/sharding-data-partitioning/#std-label-initial-ranges-empty-collection">
   Empty Collection
   <!-- -->
   .
  </a>
 </p>
 <div class="leafygreen-ui-1sjx7ru" role="note">
  <h2 class="leafygreen-ui-29m78u">
   Warning
  </h2>
  <div class="leafygreen-ui-9mycqc">
   <p class="leafygreen-ui-1kp3ins">
    Only pre-split ranges for an empty collection. Manually splitting
ranges for a populated collection can lead to unpredictable range
ranges and sizes as well as inefficient or ineffective balancing
behavior.
   </p>
  </div>
 </div>
 <section>
  <h2 class="contains-headerlink leafygreen-ui-19f71ei" weight="medium">
   Learn More
   <a class="headerlink leafygreen-ui-1kepx47" href="#learn-more" title="Permalink to this heading">
    <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
     <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
     </path>
     <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
     </path>
    </svg>
    <div class="css-1btu0w3 evvkmar0" id="learn-more">
    </div>
   </a>
  </h2>
  <ul class="leafygreen-ui-rioki0">
   <li class="leafygreen-ui-d7p7b6">
    <p class="leafygreen-ui-1kp3ins">
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/bulk-write-operations/#std-label-bulk-write-sharded-collection">
      Strategies for Bulk Inserts to a Sharded Collection
     </a>
    </p>
   </li>
   <li class="leafygreen-ui-d7p7b6">
    <p class="leafygreen-ui-1kp3ins">
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/sh.balancerCollectionStatus/#mongodb-method-sh.balancerCollectionStatus">
      <code class="leafygreen-ui-1l06pbn">
       sh.balancerCollectionStatus()
      </code>
     </a>
    </p>
   </li>
   <li class="leafygreen-ui-d7p7b6">
    <p class="leafygreen-ui-1kp3ins">
     Initial ranges created and distributed by the sharding command,
see
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/sharding-data-partitioning/#std-label-initial-ranges-empty-collection">
      Empty Collection
      <!-- -->
      .
     </a>
    </p>
   </li>
   <li class="leafygreen-ui-d7p7b6">
    <p class="leafygreen-ui-1kp3ins">
     Balancer and automatic distribution of ranges across shards,
see
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/sharding-balancer-administration/#std-label-sharding-balancing-internals">
      Balancer Internals
     </a>
     and
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/sharding-data-partitioning/#std-label-sharding-range-migration">
      Range Migration
      <!-- -->
      .
     </a>
    </p>
   </li>
   <li class="leafygreen-ui-d7p7b6">
    <p class="leafygreen-ui-1kp3ins">
     Manually migrate ranges, see
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/tutorial/migrate-chunks-in-sharded-cluster/#std-label-migrate-chunks-sharded-cluster">
      Migrate Ranges in a Sharded Cluster
      <!-- -->
      .
     </a>
    </p>
   </li>
  </ul>
 </section>
</section>
