Resolves mongodb+srv:// connection strings to mongodb:// URLs according to the MongoDB Initial DNS Seedlist Discovery specification. Acts as a pure DNS resolver, not a MongoDB driver. Version 1.1.7 is stable, released on npm. Supports ESM and includes TypeScript types. Lightweight with no runtime dependencies aside from Node.js DNS. Use when you need to resolve SRV records before passing to a MongoDB client.
npm install resolve-mongodb-srvNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates resolving a mongodb+srv:// URI to mongodb:// using the default DNS resolver.
Use await or .then() when calling resolveMongodbSrv.
Ensure URI follows mongodb+srv:// format. Validate before calling if needed.
Wrap in try-catch to handle DNS errors like ENOTFOUND.
Use the MongoDB driver (mongodb) which handles SRV resolution automatically via connection string.
Use import resolveMongodbSrv from 'resolve-mongodb-srv' or enable ESM in your project.
Use import resolveMongodbSrv from 'resolve-mongodb-srv' (no curly braces).
Check the hostname, network connectivity, and that the SRV record is properly configured.
No dependency data recorded yet.