title: Insert multiple records into database with Vapor3
body: <p>I want to be able to bulk add records to a nosql database in Vapor 3.</p>
  
  <p>This is my Struct.</p>
  
  <pre><code>struct Country: Content {
  
     let countryName: String
     let timezone: String
     let defaultPickupLocation: String
  
  }
  </code></pre>
  
  <p>So I'm trying to pass an array of JSON objects but I'm not sure how to structure the route nor how to access the array to decode each one.</p>
  
  <p>I have tried this route:</p>
  
  <pre><code>    let countryGroup = router.grouped("api/country")
  
      countryGroup.post([Country.self], at:"bulk", use: bulkAddCountries)
  </code></pre>
  
  <p>with this function:</p>
  
  <pre><code> func bulkAddCountries(req: Request, countries:[Country]) throws -&gt;  Future&lt;String&gt; {
      for country in countries{
      return try req.content.decode(Country.self).map(to: String.self) { countries in
  
  
  
          //creates a JSON encoder to encode the JSON data
          let encoder = JSONEncoder()
          let countryData:Data
          do{
              countryData = try encoder.encode(country) // encode the data
          } catch {
              return "Error. Data in the wrong format."
          }
          // code to save data
      }
      }
  }
  </code></pre>
  
  <p>So how do I structure both the Route and the function to get access to each country?</p>