program to set up replication and to add the members for the same mongo code example
Example: add members to replica set mongodb
rs.add( { host: "mongodb3.example.net:27017", priority: 0, votes: 0 } )
rs.add( { host: "mongodb3.example.net:27017", priority: 0, votes: 0 } )