summaryrefslogtreecommitdiffstats
path: root/common/src/main/webapp/usageguide/appserver/node_modules/mongoose/node_modules/muri/README.md
blob: 375741912ca0cb8cea2e1846bebe7b4a4cfc2c96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#Meet Muri!

Muri is your friendly neighborhood [MongoDB URI](http://www.mongodb.org/display/DOCS/Connections) parser for Node.js.


###Install

    $ npm install muri

###Use

```js
 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](https://github.com/aheckmann/muri/blob/master/LICENSE)