Parse mongodb:// and mongodb+srv:// connection strings into scheme, credentials, host list, database, and options. Flags common pitfalls like unencoded special characters in passwords. 100% client-side.
General format:
mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]] mongodb+srv://[username:password@]host[/[defaultauthdb][?options]]
With mongodb+srv://, the driver resolves the host list from a DNS SRV record (only a single host allowed, no port). Username and password must be percent-encoded if they contain @, :, /, or ?.