Adding multiple records for the collection of data using a single method


#1

Hey. Is there the possibility that one way to save a few records in the database collection.
I wish that every phone number “Name” and “Number” to save as a separate record in your own “_id” number.

Use the “addPhone” adds another form allows you to add additional phone number.

Here is my html code:

<form id="phones" class="col s12">

  <div class="section">
    <h5>Phones</h5>
              
    <div class="row">
      <div class="input-field col s4">
        <input id="name" name="name" type="text" class="validate">
        <label for="name">Name</label>
      </div>
      <div class="input-field col s7">
        <input id="number" name="number" type="text" class="validate">
        <label for="number">Number</label>
      </div>
      <div class="col s1">
        <a data-action="removePhone" class="btn-flat"><i class="material-icons">delete</i></a>
      </div>
    </div>
              
    <div class="row">
      <div class="input-field col s4">
        <input id="name" name="name" type="text" class="validate">
        <label for="name">Name</label>
      </div>
      <div class="input-field col s7">
        <input id="number" name="number" type="text" class="validate">
        <label for="number">Number</label>
      </div>
      <div class="col s1">
        <a data-action="removePhone" class="btn-flat"><i class="material-icons">delete</i></a>
      </div>
    </div>

              
    <a data-action="addPhone" class="waves-effect waves-light btn">Add phone</a>
  </div>

  <div class="row">
    <div class="input-field col s12">
      <button class="btn waves-effect waves-light" type="submit">Submit<i class="material-icons right">send</i></button>
    </div>
  </div>

</form>

#2

solution to this problem is to package batch-insert