Run Query on mutliple replica sets

I am new and I have a task.
Need to run Few queries on multiple replica sets to get information like

  1. how many nodes each replica has
  2. database count
  3. collection Count so on.
    Kindly share me query to run script in multiple replica sets.
    Thank you.