• Post Reply Bookmark Topic Watch Topic
  • New Topic

spring boot and mongodb replica set  RSS feed

david dabush
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:password@ 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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!