I am currently using 1 mongodb. This is how I set it up in application spring.data.mongodb.database=Active spring.data.mongodb.uri=mongodb+srv://<my_uri>
Now I need to introduce a secondary database named Inactive How do I set it up in application? Thank you.
I have tried as below, but it didn't work. spring.data.mongodb.db1.database=Active spring.data.mongodb.db1.uri=mongodb+srv://<my_uri>
spring.data.mongodb.db2.database=Inactive spring.data.mongodb.db2.uri=mongodb+srv://<my_uri>
I keep <my_uri> the same for both Active and Inactive, because I think it is the cluster'uri and both databases are inside the cluster.
You need to create a second data source and wire it in to template etc. It is a variant of this.