Skip to content

Commit

Permalink
Added replication set to README
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed May 15, 2012
1 parent 54f4676 commit c52dc8f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ It is available through npm:

npm install mongojs

## Usage

mongojs is very simple to use:

``` js
Expand Down Expand Up @@ -60,3 +62,21 @@ db.mycollection.save({created:'just now'});
```

For more detailed information about the different usages of update and quering see [the mongo docs](http://www.mongodb.org/display/DOCS/Manual)

## Replication Sets

Mongojs can also connect to a mongo replication set

``` js
var db = require('mongojs').connect({
db: 'mydb', // the name of our database
collection: ['mycollection'] // we can pass the collections here also
replSet: {
name: 'myReplSetName', // the name of the replication set
slaveOk: true, // is it to read from secondary? defaults to false
members: ['myserver:myport', 'myotherserver', 'mythirdserver']
}
});
```

For more detailed information about replica sets see [the mongo replication docs](http://www.mongodb.org/display/DOCS/Replica+Sets)

0 comments on commit c52dc8f

Please sign in to comment.