mongodb-js / resolve-mongodb-srv

Resolve mongodb+srv:// URLs to mongodb:// URLs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

resolve-mongodb-srv

Resolve mongodb+srv:// URLs to mongodb:// URLs as specified in the Initial DNS Seedlist Discovery Specification.

import resolveMongodbSrv from 'resolve-mongodb-srv';

await resolveMongodbSrv('mongodb+srv://user:password@somecluster.mongodb.net/db');
// Returns: mongodb://user:password@host1,host2,host3/db

The resolveMongodbSrv function takes an optional second argument, where the used dns implementation can be passed in:

import dns from 'dns';
import resolveMongodbSrv from 'resolve-mongodb-srv';

await resolveMongodbSrv('hostname', { dns });

LICENSE

Apache-2.0

About

Resolve mongodb+srv:// URLs to mongodb:// URLs

License:Apache License 2.0


Languages

Language:TypeScript 99.8%Language:JavaScript 0.2%