# resolve-mongodb-srv

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

Latest version **1.1.7** (published 2025-12-11) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install resolve-mongodb-srv
pnpm add resolve-mongodb-srv
yarn add resolve-mongodb-srv
bun add resolve-mongodb-srv
```

Provides the command `resolve-mongodb-srv`.

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.7 |
| Published | 2025-12-11 |
| First published | 2021-05-11 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 25.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | mongodb-js-user, rueckstiess, durran, alexander_schroll, mbroadst, hswolff, satyasinha, matt_d_rat, jeff-allen-mongo, jonathan.balsano, mongodb-build, jack.weir, mcasimir, kristina.stefano, jarjee, shaketbaby, devtoolsbot, addaleax, gribnoysup, mutukrish, mongo-j, nbbeeken, dbx-node, nirinchev, pearsb1 |
| Keywords | mongodb, srv, url |

## Links

- npm: https://www.npmjs.com/package/resolve-mongodb-srv
- Repository: https://github.com/mongodb-js/resolve-mongodb-srv
- Issues: https://github.com/mongodb-js/resolve-mongodb-srv/issues
- npm.io page: https://npm.io/package/resolve-mongodb-srv

## Dependencies (1)

- [whatwg-url](https://npm.io/package/whatwg-url.md) ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 1.1.7 (latest) — 2025-12-11
- 1.1.6 — 2025-12-04
- 1.1.5 — 2024-05-10
- 1.1.4 — 2024-05-10
- 1.1.3 — 2023-11-17
- 1.1.2 — 2022-08-03
- 1.1.1 — 2021-11-25
- 1.1.0 — 2021-06-15
- 1.0.1 — 2021-05-11
- 1.0.0 — 2021-05-11

## README

# resolve-mongodb-srv

Resolve `mongodb+srv://` URLs to `mongodb://` URLs as specified in the
[Initial DNS Seedlist Discovery Specification](https://github.com/mongodb/specifications/blob/master/source/initial-dns-seedlist-discovery/initial-dns-seedlist-discovery.rst).

```js
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:

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

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

## LICENSE

Apache-2.0

---
_Source: https://npm.io/package/resolve-mongodb-srv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
