If I've to get something like analogous to SQL statement from rs.status output to print specific value of an attribute in mongoDB -
Something like print health of specific node of a replica set from rs.status.
select health from rs.status where hostname like 'abc:123'
or something to print lagtime of a specific secondary replica node with respect to Primary node using :
print lagtime from rs.printSlaveReplicationInfo() where hostname like 'abc:123'
what would be the simple query or JS to run against a replica set connection string ?
rs.printSlaveReplicationInfo(). I would like to capture only specific key value like for health either 1 or 0 and assign that value to a variable in Linux shell. Is there any simplest way.