I am writing a bash script in our linux server about extracting a report from MongoDB. In fact, there are two more replica servers and I should extract the report if the it is master at that time for that server. If not, script will not extract anything.
Is there a way to get that information from shell? Thanks.