|
il y a 1 an | |
---|---|---|
.. | ||
lib | il y a 1 an | |
.esm-wrapper.mjs | il y a 1 an | |
LICENSE | il y a 1 an | |
README.md | il y a 1 an | |
package.json | il y a 1 an |
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'
.host
, .hostname
and .port
properties cannot be set, and reading
them does not return meaningful results (and are typed as never
in TypeScript).hosts
property contains a list of all hosts in the connection string.href
property cannot be set, only read.isSRV
property, set to true
for mongodb+srv://
.clone()
utility method on the prototypeApache-2.0