|  | 6 years ago | |
|---|---|---|
| .. | ||
| lib | 6 years ago | |
| test | 6 years ago | |
| .npmignore | 6 years ago | |
| .travis.yml | 6 years ago | |
| History.md | 6 years ago | |
| LICENSE | 6 years ago | |
| Makefile | 6 years ago | |
| README.md | 6 years ago | |
| index.js | 6 years ago | |
| package.json | 6 years ago | |
Muri is your friendly neighborhood MongoDB URI parser for Node.js.
$ npm install muri
 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'
   }
 }
The returned object contains the following properties:
{ user: 'username', pass: 'password' }[{ host: 'local', port: 27107 }, { host: '..', port: port }]
ipc will be set to the value specified [{ ipc: '/tmp/mongodb-27017' }]