Git Product home page Git Product logo

muri's Introduction

Meet Muri!

Muri is your friendly neighborhood MongoDB URI parser for Node.js.

Install

$ npm install muri

Use

 var muri = require('muri');
 var o = muri('mongodb://user:pass@local,remote:27018,japan:27019/neatdb?replicaSet=myreplset&journal=true&w=2&wtimeoutMS=50');

 console.log(o);

 { hosts: [ { host: 'local',  port: 27017 },
            { host: 'remote', port: 27018 },
            { host: 'japan',  port: 27019 } ],
   db: 'neatdb',
   options: {
     replicaSet: 'myreplset',
     journal: true,
     w: 2,
     wtimeoutMS: 50
   },
   auth: {
     user: 'user',
     pass: 'pass'
   }
 }

Details

The returned object contains the following properties:

  • db: the name of the database. defaults to "admin" if not specified
  • auth: if auth is specified, this object will exist { user: 'username', pass: 'password' }
  • hosts: array of host/port objects, one for each specified [{ host: 'local', port: 27107 }, { host: '..', port: port }]
    • if a port is not specified for a given host, the default port (27017) is used
    • if a unix domain socket is passed, host/port will be undefined and ipc will be set to the value specified [{ ipc: '/tmp/mongodb-27017' }]
  • options: this is a hash of all options specified in the querystring

License

MIT

muri's People

Contributors

aheckmann avatar eladnava avatar kevinadi avatar prototypeme avatar salman-amjad avatar vkarpov15 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.