Socket
Socket
Sign inDemoInstall

mongo-url-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mongo-url-parser

parse mongodb connection strings.


Version published
Weekly downloads
986
decreased by-17.56%
Maintainers
1
Install size
24.7 kB
Created
Weekly downloads
 

Readme

Source

mongo-url-parser

Simple parser for mongodb connection strings.

Usage

npm install --save mongo-url-parser
const parser = require('mongo-url-parser');
const url = 'mongodb://myDBReader:D1fficultP%40ssw0rd@mongodb0.example.com:27017/?authSource=admin';
const parsed = parser(url);

parsed now contains the following

{
  usingSrv: false,
  auth: { user: 'myDBReader', password: 'D1fficultP@ssw0rd' },
  server_options: { socketOptions: {} },
  db_options: {
    read_preference_tags: null,
    authSource: 'admin',
    read_preference: 'primary'
  },
  rs_options: { socketOptions: {} },
  mongos_options: {},
  dbName: 'admin',
  servers: [ { host: 'mongodb0.example.com', port: 27017 } ]
}

This is based on the connection string parser from the mongodb driver.

License

Apache 2.0

Keywords

FAQs

Last updated on 09 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc