In the getConfigDB helper that is used by sh.status() and a number of similar sharding-related methods, we verify that the hello response indicates that we are actually connected to a mongos instance.
However, as long as the required databases (config etc.) are present, these methods can work even when not connected to a mongos.
One example use case is running sh.status() on standalone instances that contain data restored from a sharded instance, which seems to be a common TSE operation.
Related Slack thread: https://mongodb.slack.com/archives/CUHC9R8J0/p1631144479043300
We should print a warning instead of outright throwing.
Additionally, our sh.status() method does not take a configDB argument, unlike the legacy shell variant. We should fix that as well.
- is related to
-
MONGOSH-742 Improve sh.status() test coverage
- Open