Uses port specified in an SRVRecord instead of overwriting the port from initial ConnectionSettings.Host.port value.
Motivation and Context
When mongodb+srv// scheme is used to connect to a database it uses default port number 27017. Hosts resolved from the service might use arbitrary port numbers. Using default port to connect to hosts leads to connection error.
How Has This Been Tested?
I successfully connected to database via mongodb+srv// scheme that resolved hosts requiring specific port number.
Checklist:
[ ] If applicable, I have updated the documentation accordingly.
[ ] If applicable, I have added tests to cover my changes.
Description
Uses port specified in an
SRVRecord
instead of overwriting the port from initialConnectionSettings.Host.port
value.Motivation and Context
When
mongodb+srv//
scheme is used to connect to a database it uses default port number27017
. Hosts resolved from the service might use arbitrary port numbers. Using default port to connect to hosts leads to connection error.How Has This Been Tested?
I successfully connected to database via
mongodb+srv//
scheme that resolved hosts requiring specific port number.Checklist: