title: Initialize data on the database (Spring & Mongo)
body: <p>I'm using mongock to generate the initial data on the database and so far it's working fine for <code>Country</code> but still a long way to go</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>@ChangeUnit(id="country-initializer", order = "1")
  public class CountryInitializerCU {
  
      @BeforeExecution
      public void beforeExecution(MongoTemplate mongoTemplate) {
          mongoTemplate.createCollection(COUNTRY_COLLECTION_NAME);
      }
  
      @RollbackBeforeExecution
      public void rollbackBeforeExecution() {
          // do nothing
      }
  
      @Execution
      public void execution(CountryRepository countryRepository) {
          List&lt;Country&gt; countries = new ArrayList&lt;&gt;();
  
          countries.add(new Country("AM", "ARM", "Armenia"));
          countries.add(new Country("AL", "ALB", "Albania"));
          countries.add(new Country("AO", "AGO", "Angola"));
          countries.add(new Country("BS", "BHS", "Bahamas"));
          countries.add(new Country("BY", "BLR", "Bahamas"));
          // TODO
  
          countryRepository.saveAll(countries);
  
      }
  
      @RollbackExecution
      public void rollbackExecution(MongoTemplate mongoTemplate) {
          mongoTemplate.dropCollection(COUNTRY_COLLECTION_NAME);
      }
  }</code></pre>
  </div>
  </div>
  </p>
  <p>The problem that I see now is that I need to to the same for <code>Places</code>. The problem is that <code>Places</code> have <code>140.000 records</code>. Imagine filling that by hand. I have those places in a 200MB json file that I could use instead of filling manually.</p>
  <p>What is the best approach?</p>