I Have a spring boot server and I want to connect it to my mongoDB replica set. (3 servers in the set)
1.in application.properties I configured: spring.data.mongodb.uri=mongodb://user:firstname.lastname@example.org:27017/admin but if I try to write to server that is not the primary I get error. so how can I configure it that my spring boot app always know who is the primary and write to the primary?
I always connect to the admin DB. but I need access to another db because my collection is there. how can I configure that the user will connect to all db? because this user will work with different dbs and different collections?
Thanks a lot