title: Mongodb check for duplicate records for bulk insertions
body: <p>My collection has records like:</p>
  
  <pre><code>{ "_id":"1", "field1":"foo","field2":"xyz", "field3":"something" ...}
  { "_id":"2", "field1":"bar","field2":"xyz", "field3":"something" ...}
  { "_id":"3", "field1":"foo","field2":"abc", "field3":"something" ...}
  { "_id":"4", "field1":"bar","field2":"lmn", "field3":"something" ...}
  </code></pre>
  
  <p>Before inserting a new record i need to check if a record with same field1 and field2 value already exists. And then discard the request, if it already exists. I can manage to do this if i was inserting one record at a time. How do i handle this if im doing a bulk insert (i.e. when im inserting array of documents)?</p>
  
  <p>I have array of <code>[field1, field2]</code> combinations which i need to look up
  EX: </p>
  
  <pre><code>queryArray=[ { "field1":"foo","field2":"xyz"},
               { "field1":"bar","field2":"lmn"} ]
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre><code>result=[  { "_id":"1", "field1":"foo","field2":"xyz", "field3":"something" ...},
            { "_id":"4", "field1":"bar","field2":"lmn", "field3":"something" ...}]
  </code></pre>