Created
January 11, 2022 19:27
-
-
Save pujianto/b73ebd487a8fb32ede67d289549f15e4 to your computer and use it in GitHub Desktop.
Get database name from Mongo/Mysql URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dbUrl example: mongodb://user:[email protected]/MyDB?authsource=admin | |
const getDatabaseName = (dbUrl) => url.parse(dbUrl).pathname.substring(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment