{"id":43528,"library":"parse-mongo-url","title":"parse-mongo-url","description":"Parses MongoDB connection strings into structured objects. Based on the url_parser.js from the MongoDB Node.js native driver v2.0. Version 1.1.1 is stable but has no recent updates (last release in 2017). Lightweight with zero dependencies. Provides a simple API to extract hosts, database name, authentication, and options from MongoDB URIs. Suitable for legacy projects, but for new code consider using the official mongodb driver's built-in parsing or the `mongodb-connection-string-url` package.","status":"abandoned","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/sorribas/parse-mongo-url","tags":["javascript"],"install":[{"cmd":"npm install parse-mongo-url","lang":"bash","label":"npm"},{"cmd":"yarn add parse-mongo-url","lang":"bash","label":"yarn"},{"cmd":"pnpm add parse-mongo-url","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CJS-only; default import works via synthetic default in TS/ESM. For CJS: const parse = require('parse-mongo-url')","wrong":"const parse = require('parse-mongo-url').default","symbol":"default","correct":"import parse from 'parse-mongo-url'"},{"note":"The module exports a single function, not a named export.","wrong":"const { parse } = require('parse-mongo-url')","symbol":"default","correct":"const parse = require('parse-mongo-url')"}],"quickstart":{"code":"const parse = require('parse-mongo-url');\nconst uri = 'mongodb://user:pass@localhost:27017/db?replicaSet=rs0';\nconst parsed = parse(uri);\nconsole.log(parsed);\n// {\n//   hosts: [{ host: 'localhost', port: 27017 }],\n//   database: 'db',\n//   auth: { user: 'user', password: 'pass' },\n//   options: { replicaSet: 'rs0' }\n// }","lang":"javascript","description":"Parses a MongoDB connection string and logs the structured result showing hosts, database, auth, and options."},"warnings":[{"fix":"Replace with import { parse } from 'mongodb-connection-string-url' or use MongoClient's built-in parsing.","message":"Package is no longer maintained; consider using mongodb-connection-string-url or the official MongoDB driver's parsing.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.1.1':24 '2017':35 'api':43 'authent':49 'base':12 'built':71 'built-in':70 'code':62 'connect':7,78 'consid':63 'databas':47 'depend':39 'driver':21,68 'extract':45 'host':46 'javascript':82 'last':32 'legaci':57 'lightweight':36 'mongo':3 'mongodb':6,18,53,67,77 'mongodb-connection-string-url':76 'name':48 'nativ':20 'new':61 'node.js':19 'object':11 'offici':66 'option':51 'packag':81 'pars':2,5,73 'parse-mongo-url':1 'project':58 'provid':40 'recent':30 'releas':33 'simpl':42 'stabl':26 'string':8,79 'structur':10 'suitabl':55 'updat':31 'uri':54 'url':4,80 'url_parser.js':15 'use':64 'v2.0':22 'version':23 'zero':38","created_at":"2026-06-05T17:00:14.011422+00:00","updated_at":"2026-06-05T17:00:14.011422+00:00","problems":[{"fix":"Use const parse = require('parse-mongo-url') (or import parse from 'parse-mongo-url' with ESM).","cause":"Using named import { parse } when the module exports a single function as default.","error":"TypeError: parse is not a function"},{"fix":"Create a `declare module 'parse-mongo-url'` declaration or use `// @ts-ignore`. Consider switching to mongodb-connection-string-url which has types.","cause":"Package does not include TypeScript types. TypeScript projects may need a custom declaration file.","error":"Cannot find module 'parse-mongo-url' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/sorribas/parse-mongo-url","github":"https://github.com/sorribas/parse-mongo-url","docs":null,"changelog":null,"pypi":null,"npm":"parse-mongo-url","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}