How to connect explicitly to analytics node if there are multiple analytics node?

Hi @AARZOO_MANOOSI

This is a good use case for replica set tags. See the tutorial how to set them up.

So you can setup a tag like {'usage':'analytics'} and then use that for the readPreferenceTags for the connection.

mongodb://host0.example.com/database?replicaSet=rsName&readPreference=secondary&readPreferenceTags=usage:analytics

3 Likes