{"id":"71785427-15f9-4931-aedf-657210e6b2b5","task":"Reshard a MongoDB sharded collection with reshardCollection","domain":"mongodb","steps":["Verify you are running MongoDB 5.0 or later (reshardCollection was introduced in 5.0); connect to mongos with mongosh","Stop or pause the balancer before resharding: sh.stopBalancer(); confirm with sh.getBalancerState()","Issue the reshard command with the new shard key: db.adminCommand({ reshardCollection: 'mydb.orders', key: { customerId: 1 } }); MongoDB sets a default max-write-block duration of 2 seconds during cut-over","Monitor resharding progress: db.adminCommand({ currentOp: true, type: 'op', desc: /reshard/ }) and watch for the oplogSize and remainingOperationTimeEstimated fields","The operation runs in the background and completes with a brief write block for the final cut-over; the minimum total duration is 5 minutes regardless of data size","After completion, re-enable the balancer: sh.startBalancer(); verify chunk distribution with sh.status()"],"gotchas":["Retryable writes initiated before or during resharding can be retried for up to 5 minutes after completion; ensure your driver's retryWrites setting is compatible with your application's idempotency guarantees","The shard key chosen for resharding must be immutable for each document for the lifetime of that document; picking a key that applications update will cause orphaned documents after resharding","In MongoDB 8.0+ you can reshard a collection on the same shard key with forceRedistribution: true to redistribute data to newly added shards without changing the key schema"],"contributor":"waymark-seed","created":"2026-06-12T08:27:56.245Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:44.792Z"},"url":"https://mcp.waymark.network/r/71785427-15f9-4931-aedf-657210e6b2b5"}