mongodb-connection-string-url
TypeScript icon, indicating that this package has built-in type declarations

3.0.2 • Public • Published

mongodb-connection-string-url

MongoDB connection strings, based on the WhatWG URL API

import ConnectionString from 'mongodb-connection-string-url';

const cs = new ConnectionString('mongodb://localhost');
cs.searchParams.set('readPreference', 'secondary');
console.log(cs.href); // 'mongodb://localhost/?readPreference=secondary'

Deviations from the WhatWG URL package

  • URL parameters are case-insensitive
  • The .host, .hostname and .port properties cannot be set, and reading them does not return meaningful results (and are typed as neverin TypeScript)
  • The .hosts property contains a list of all hosts in the connection string
  • The .href property cannot be set, only read
  • There is an additional .isSRV property, set to true for mongodb+srv://
  • There is an additional .clone() utility method on the prototype

LICENSE

Apache-2.0

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.2
2,184,570latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.2
2,184,570
3.0.1662,681
3.0.0326,495
2.6.02,226,663
2.5.438,129
2.5.338,156
2.5.256,538
2.5.1926
2.5.01
2.4.28,305
2.4.113,008
2.4.02
2.3.23,396
2.3.157
2.3.071
2.2.07,537
2.1.016,990
2.0.05,382
1.1.25,013
1.1.112
1.1.0190
1.0.20
1.0.1860
1.0.0127

Package Sidebar

Install

npm i mongodb-connection-string-url

Weekly Downloads

5,595,109

Version

3.0.2

License

Apache-2.0

Unpacked Size

38.4 kB

Total Files

10

Last publish

Collaborators

  • 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