rs.initiate({ _id: "shard2ReplSet", members: [ { _id: 0, host: "shard2-0.shard2.mongodb.svc.cluster.local:27018" }, { _id: 1, host: "shard2-1.shard2.mongodb.svc.cluster.local:27018" }, { _id: 2, host: "shard2-2.shard2.mongodb.svc.cluster.local:27018" } ] }) rs.status().members.map(m => ({ name: m.name, state: m.stateStr })) exit