When upgrading a sharded cluster, your sequence of steps should be as follows:
- Log in to the mongos shell and stop the balancer using the sh.stopBalancer() command.
- First upgrade the config server replica set.
- Upgrade each shard individually.
- Upgrade the mongos query routers.
- Finally, connect the mongos shell and start the balancer using the sh.startBalancer() command.