connecting to replica set mongodb code example
Example 1: add members to replica set mongodb
rs.add( { host: "mongodb3.example.net:27017", priority: 0, votes: 0 } )
Example 2: replica set mongodb
A replica set in MongoDB is a group of mongod processes that maintain the same data set. Replica sets provide redundancy and high availability, and are the basis for all production deployments. This section introduces replication in MongoDB as well as the components and architecture of replica sets.