We should make sure that the replica set has stabilized (i.e. the nodes are either primary or secondary) before performing validation.
We can do this by calling awaitSecondaryNodes before we validate, here (unsharded) and here (sharded).
We should make sure that the replica set has stabilized (i.e. the nodes are either primary or secondary) before performing validation.
We can do this by calling awaitSecondaryNodes before we validate, here (unsharded) and here (sharded).