title: Mongoose insertMany function
body: <p>I'm currently working on a data import function for mongodb</p>
  
  <p>It look something like this</p>
  
  <p><em>Note : the data using for importing is grabbing from an temporary collection in database and massaged before the insertion</em></p>
  
  <pre><code>var Member = require('MemberModel'); //nodejs Mongoose npm
  var arr = [{
      'memberNo': 'M001',
      'name': 'member 1'
  }, ...];
  
  Member.insertMany(arr, {ordered:false}, function(err, res){
      arr.forEach(function(item){
          //check exist in res using memberNo
      })
  });
  </code></pre>
  
  <p>Currently, after the <code>insertMany</code>, I'll use looping to check whether the record in the array has been insert to database or not, and last, display which record(s) that failed to be insert deal to validation or something else.</p>
  
  <p>This method is fairly inefficient when dealing with large amount of data.</p>
  
  <p>It there any better way to do this ? or there is some <code>options</code> that i missed out from <code>Mongoose</code>.</p>
  
  <p>Any help to this will be appreciated.</p>