orlandos-nl / MongoKitten

Native MongoDB driver for Swift, written in Swift
https://orlandos.nl/docs/mongokitten/
MIT License
709 stars 101 forks source link

Uses port from SRVRecord #324

Closed maciejpiotrowski89 closed 11 months ago

maciejpiotrowski89 commented 11 months ago

Description

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.

Screenshot 2023-10-18 at 15 55 42

Checklist: