insert mongo document field only when it's missing
<p>Novice question:</p>

<p>I have a mongo collection that was created before.  Some recent documents have been inserted but the structure slightly changes -- only new fields were added.  Now I'd like to go back and update the old documents with the new fields with a default value.  How?</p>

<p>Example:</p>

<pre><code>db.testme.insert({x:0, y:1})
db.testme.insert({x:1, y:1})
db.testme.insert({x:0, y:1, z:2})
db.testme.find()
</code></pre>

<p>How do I update the first two documents with "z" value of zero?</p>