Hot answers tagged

1

No need to use another tool, you could just: ./mongo -udbadm admin --port 27100 -p --quiet --eval "rs.status().members.find((m) => m.stateStr === "SECONDARY").name" to get: example-1.domain:27200 Note that the find method will return the first element found.


Only top voted, non community-wiki answers of a minimum length are eligible