7fife-backend/node_modules/mongodb-connection-string-url
Nawaaz b8a5323689 updated code 2024-03-11 17:59:54 +05:30
..
lib update code 2024-03-07 18:31:44 +05:30
.esm-wrapper.mjs update code 2024-03-07 18:31:44 +05:30
LICENSE update code 2024-03-07 18:31:44 +05:30
README.md update code 2024-03-07 18:31:44 +05:30
package.json updated code 2024-03-11 17:59:54 +05:30

README.md

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