title: spring-data-mongodb. How can i dynamically create a database in mongo using spring-data-mongodb library?
body: <p>spring-data-mongodb. How can i dynamically create a database in mongo using spring-data-mongodb library?</p>
  
  <p>I am trying to use Spring-Mongodb-Data module for CRUD operations against Mongo database and going through examples and articles my assumption is that databasename should be pre-defined in spring context xml when defining MongoTemplate bean.</p>
  
  <p>In my case I have an multi-tenant application that will accept requests over http and my application should create the mongodatabase on-the-fly and use the name provided in the input http request to create the database and then load the data into collection in the newly created database.</p>
  
  <p>I am trying to figure out if there is a way to dynamically populate the databasename in MongoTemplate or MongoRepository without having to provide it in spring context.xml?</p>
  
  <p>Please help me.</p>
  
  <p>Thanks
  -RK</p>