How Insert In multiple database MongoDB with Java Springboot in Maven project

Viewed 20

I am wondering if is it possible to insert in multiple databases in MongoDB. I have on my pom.xml project this connection structure:

    <configuration.database.host>XXX.XXX.XXX.XXX</configuration.database.host>
    <configuration.database.port>27017</configuration.database.port>
    <configuration.database.username>useradmin</configuration.database.username>
    <configuration.database.password>userpass</configuration.database.password>
    <configuration.database>database1</configuration.database>    
<configuration.database.collection.documentone>master</configuration.database.collection.documentone>
<configuration.database.collection.documentone.documenttwo>master_advice</configuration.database.collection.documentone.documenttwo>

Now, I need to add in the project another database to insert in antoher document some information, I don't know if I can add another connection and how can I do. for example, in the pom adding:

<configuration.database>database2</configuration.database>
    <configuration.database.collection.documentone>cluster</configuration.database.collection.documentone>

of course, considering the configuration in the application.properties file.

0 Answers
Related