<!-- llms-explorer concept facts · https://llms-explorer.com/tree/movecollection-and-unshardcollection/ · pack 2026-10-31 · ~1498 tokens -->

# moveCollection and unshardCollection

> Source-anchored research for moveCollection and unshardCollection. Run status: COMPLETED.

Parent: [Shard Key Design and Resharding as Cost Levers](https://llms-explorer.com/tree/shard-key-design-and-resharding-as-cost-levers/) · 5 facets · 17 facts · page: https://llms-explorer.com/tree/movecollection-and-unshardcollection/

## How it works

- SERVER-123150 proposes a fast path for unshardCollection when all chunks already reside on the destination shard. Its October 26, 2026 update still shows Unresolved and no fix version; do not assume this case avoids cloning. (low confidence) (verified as of 2026-10-26) — [source](https://jira.mongodb.org/browse/SERVER-123150)

## How-to and procedures

- Run moveCollection through mongos on the admin database with the collection namespace and required toShard recipient ID; listShards supplies recipient IDs. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)

## Measurements and reference values

- For both operations, MongoDB documents destination free storage of at least 2 × (collection storage size + index size), I/O utilization below 50%, and CPU load below 80%. The moveCollection reference says these resource requirements are not enforced by the database. (medium confidence) (verified as of 2026-10-30) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)

## Problems, failure modes and limitations

- Both command references prohibit topology changes until completion and warn that concurrent index builds may silently fail. Complete index builds before starting and avoid building indexes during these operations. (medium confidence) (verified as of 2026-10-30) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)
- Alibaba Cloud DTS warns against running moveCollection or unshardCollection on a MongoDB sharded source while its migration is active, because changing data distribution can cause inconsistency. This is a DTS integration restriction, not a universal command limitation. (low confidence) (verified as of 2026-09-30) — [source](https://www.alibabacloud.com/help/en/dts/user-guide/precautions-and-limits-for-migrating-data-from-a-mongodb-database)
- The unshardCollection reference warns that unsharding is write-intensive and can accelerate oplog growth; it recommends considering a fixed oplog size and sufficient oplog capacity to reduce stale-secondary risk. (low confidence) (verified as of 2026-10-30) — [source](https://www.mongodb.com/docs/manual/reference/command/unshardCollection.md)

## Facts and statements

- Introduced in MongoDB 8.0, moveCollection relocates one unsharded collection to another shard without a dump-and-reload workflow; unshardCollection converts a sharded collection into an unsharded collection on one shard. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)
- moveCollection requires toShard; unshardCollection accepts it optionally and otherwise chooses the shard with the least data. Both commands run against the admin database in a sharded cluster. (medium confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)
- MongoDB documents a five-minute minimum duration and a roughly two-second write-blocking period for these operations; the brief write pause is not the total operation time. (medium confidence) (verified as of 2026-10-14) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)
- MongoDB Search indexes become unavailable after either operation and must be rebuilt manually. (medium confidence) (verified as of 2026-10-30) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)
- NoSQLBooster's January 24, 2025 release entry lists sh.moveCollection, sh.unshardCollection, and both abort helpers among its MongoDB 8.0 methods. This documents client tooling support, not an independent server-performance benchmark. (low confidence) (verified as of 2025-01-24) — [source](https://www.nosqlbooster.com/blog/)
- Introduced in MongoDB 8.0, moveCollection moves one unsharded collection to another shard; this allows collection placement for resource optimization without sharding that collection. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)
- Introduced in MongoDB 8.0, unshardCollection consolidates a sharded collection onto one shard; the command reference states that it removes the shard key. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/command/unshardCollection.md)
- unshardCollection accepts an optional toShard; if omitted, the command reference and Alibaba Cloud feature documentation say MongoDB chooses the shard with the least data. (medium confidence) (verified as of 2026-03-28) — [source](https://www.mongodb.com/docs/manual/reference/command/unshardCollection.md)
- Both command references specify a five-minute minimum duration; neither command should be planned as an instantaneous metadata-only change. (medium confidence) (verified as of 2026-10-30) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)
- Both command references require application tolerance for a two-second period of blocked writes with increased latency. Alibaba also describes approximately two seconds of write blocking for moveCollection; this is planning guidance, not a measured universal latency guarantee. (medium confidence) (verified as of 2026-03-28) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)
- Neither command supports Queryable Encryption collections; both command references also exclude Atlas Free/M0 and Flex deployments. (medium confidence) (verified as of 2026-10-30) — [source](https://www.mongodb.com/docs/manual/reference/command/moveCollection.md)
