title: mongodb - mongoimport stopOnError option
body: <p>As per the mongodb documentation, stopOnError option forces mongoimport to halt the import operation at the first error rather than continuing the operation despite errors.</p>
  
  <p>What are the various errors for which this option works?</p>
  
  <p>I have tested it for the following error conditions:</p>
  
  <ol>
  <li><p>Stopped the mongod instance. I get following error indicating it lost connection with the mongodb.</p>
  
  <pre><code>assertion: 10276 DBClientBase::findN: transport error: 127.0.0.1:15055 ns: admin.$cmd query: { getlasterror: 1 }
  </code></pre></li>
  <li><p>Imported the same file again to same db and collection. This should give me duplicate entry error. Although, the error is displayed, import is not halted.</p>
  
  <pre><code>Mon Jul 15 16:28:40.652 E11000 duplicate key error index: users.contacts_2.$_id_  dup key: { : "xexjiroiqcwujiuxrmedntmxhalniwygdyplrfvkjvfugdvxpadfvpferqtaquht" }
  Mon Jul 15 16:28:40.652 check 9 11
  Mon Jul 15 16:28:40.652 E11000 duplicate key error index: users.contacts_2.$_id_  dup key: { : "uyioegyqcenijjickljgdpmvihvyefvyfenjkmcptqafalhmwrvbjkwrtutybpxg" }
  Mon Jul 15 16:28:40.652 imported 10 objects
  </code></pre></li>
  </ol>
  
  <p>Now, i am confused. Does stopOnError works just for network errors or also for write error? Is there any way we can set write concerns or get the getLastError status while using mongoimport?</p>