We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64dc781 commit 1b46769Copy full SHA for 1b46769
packages/mongodb-memory-server-core/src/util/utils.ts
@@ -20,7 +20,8 @@ export function generateDbName(dbName?: string): string {
20
* @param {string} uri mongodb URI
21
*/
22
export function getHost(uri: string): string {
23
- return uri.replace('mongodb://', '').replace(/\/.*/, '');
+ // this will turn "mongodb://user:pass@localhost:port/authdb?queryoptions=1" to "localhost:port"
24
+ return uri.replace(/(?:^mongodb:\/{2})|(?:\/.*$)|(?:.*@)/gim, '');
25
}
26
27
/**
0 commit comments