Mongosh command rejects host names with an underscore which are accepted by mongo command

Why would you expect non compliant names to work anywhere. Even if a tool parses it okay there is no guarantees that the underlying resolution standard libraries or system calls will allow it either.

The correct solution is to used compliant host names.

2 Likes