I'm using spring boot and database mongo. Our database is placed on AWS cluster. Inside data source we have couples databases(AccountsDB, SubscriptionsDB etc). I did realization, when in Spring boot I connected to 2 databases using disable autoconfiguration in application.properties file and connect to mongoDB twice: ones, to database AccountsDB(
mongodb://${MONGO_DB_USERNAME}:${MONGO_DB_PASSWORD}@${MONGODB_HOST}:${MONGODB_PORT}/{AccountsDB}?replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false
), and second connection to SubscriptionDB(
mongodb://${MONGO_DB_USERNAME}:${MONGO_DB_PASSWORD}@${MONGODB_HOST}:${MONGODB_PORT}/{SubscriptionDB}?replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false
). But my manager unhappy with this realization... There is any way to connect to data source without clarification of data base name? I couldn't find any solution for this, if we are not clarify its not showing any data. Thank you for any replying
I tried to connect without clarification, and it doesn't display any data
mongodb://${MONGO_DB_USERNAME}:${MONGO_DB_PASSWORD}@${MONGODB_HOST}:${MONGODB_PORT}/?replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false
Might be any way to connect to datasource and after using SpringJPA make connection?