You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			|  | 3 years ago | |
|---|---|---|
| .. | ||
| lib | 3 years ago | |
| node_modules | 3 years ago | |
| .esm-wrapper.mjs | 3 years ago | |
| LICENSE | 3 years ago | |
| README.md | 3 years ago | |
| package.json | 3 years ago | |
		
			
				
				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,.hostnameand.portproperties cannot be set, and reading them does not return meaningful results (and are typed asneverin TypeScript)
- The .hostsproperty contains a list of all hosts in the connection string
- The .hrefproperty cannot be set, only read
- There is an additional .isSRVproperty, set totrueformongodb+srv://
- There is an additional .clone()utility method on the prototype
LICENSE
Apache-2.0