title: How to interpret the lastErrorObject properties returned from MongoDB?
body: <p>MongoDB sometimes return a <code>lastErrorObject</code> - and as far as I can read this is its schema:</p>
  
  <pre><code>{
    updatedExisting: &lt;boolean&gt;,
    upserted: &lt;boolean&gt;,
    n: &lt;num&gt;,
    connectionId: &lt;num&gt;,
    err: &lt;string&gt;,
    ok: &lt;num&gt;
  }
  </code></pre>
  
  <p>But the only place on the mongodb.org website I can find any reference to this object is buried in the <a href="http://docs.mongodb.org/manual/reference/command/findAndModify/" rel="noreferrer">findAndModify API documentation</a>.</p>
  
  <p>But nowhere can I find any explanation of the different properties of the object. I can make educated guesses, but even what I can make out from the documentation seems to contradict it self. Like for instance <code>upserted</code>, which according to findAndModify should be a boolean, but apparently also can be an <code>ObjectId</code>.</p>
  
  <p>And what is <code>ok</code>? It seems to be <code>1</code> most of the time - but it's not a boolean, so can it be <code>2</code> and what does that mean?</p>
  
  <p>Even though some of the properties might be pretty self-explanatory, please write an explanation for each in your answer so it's 100% documented for everybody. Or if I just missed it (it happens), feel free to link to the documentation where this is explained ;)</p>