Splitting and Merging Chunks in Mongo 4.4.x

Hi All,

Good day! We have a Mongo 4.4.x cluster with n shards in a PSS setup currently operational. we disable auto-split by default as we have some collections in the database that we don’t want to be auto splitted. in 4.4.x there is no way to limit splitting to certain collections or exclude certain collections from splitting so we decided to disable auto split and manually do the chunk splitting ourselves as needed.

There is a IO heavy collection which appears to be a little bit unevenly distributed so we decided to run the autosplit script to create new chunks so that we can get a better balance across shards. However, due to a mistake, the split ran on only 1 shard and it created too many chunks. I have disabled the balancer for now so all chunks are still on that shard.

Question is - how can i run mergeChunks to join these split smaller chunks into bigger chunks? Is there a script available that can do this? Latest mongo 7.x seems to have a function which can do this operation out of box: https://www.mongodb.com/docs/v7.2/reference/command/mergeAllChunksOnShard/

However, i am looking for an equivalent in 4.4.x.

Thank you very much in advance.