On top of the considerations for replica sets, there are a few more to keep in mind for sharded clusters. They are as follows:
- The change stream is executed against every shard in a cluster and will be as fast as the slowest shard.
- To avoid creating change stream events for orphaned documents, we need to use the new feature of ACID compliant transactions if we have multi-document updates under sharding.
While sharding an unsharded collection (that is, migrating from replica sets to sharding), documentKey of the change stream notification document will include _id until the change stream catches up to the first chunk migration.