Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add some docs

  • Loading branch information...
commit de1a591bf20acfec1835da77248a4d55e6841438 1 parent c8fba98
Addison Higham addisonj authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 Readme.md
18 Readme.md
View
@@ -58,6 +58,24 @@ Remember the guiding principle: the syntax exactly matches the [command-line dri
db.collection('users')
db.users.count(cb)
+#### Replica Sets
+
+Replica sets are also supported with an alternate function signature:
+``` JavaScript
+var hostsArray = [
+ // opts is a hash of mongodb-native server opts: http://mongodb.github.com/node-mongodb-native/api-generated/server.html
+ // also optional
+ {host: "host1", port: 27017, opts: {}},
+ {host: "host1", port: 27018, opts: {}},
+ ...
+]
+// other replica set opts, such as read_secondary, are passed in here
+// these opts are also passed to each mongodb-native server object, so you can have defaults for your servers
+var opts = {rs_name: "myReplicaSet"}
+
+mongo.db(hostsArray, opts, dbname, [prefix], [username], [password])
+```
+
#### Authentication
Please sign in to comment.
Something went wrong with that request. Please try again.