title: MongoDB update. Trying to set one field from a property of another
body: <p>What I'm trying  to do is pretty straightforward, but I can't find out how to give one field the value of another.</p>
  
  <p>I simply want to update one field with the character count of another.</p>
  
  <pre><code>db.collection.update({$exists:true},{$set : {field1 : field2.length}})
  </code></pre>
  
  <p>I've tried giving it dot notation</p>
  
  <pre><code>db.collection.update({$exits:true},{$set : {field1: "this.field2.length"}})
  </code></pre>
  
  <p>As well as using javascript syntax</p>
  
  <pre><code>db.collection.update({$exits:true},
                       {$set : {field1: {$where : "this.field2.length"}})
  </code></pre>
  
  <p>But just copied the string and got a "notOkforstorage" respectively. Any help?</p>
  
  <p>Update:
  I only get the "notOkforStorage" when I query by ID:</p>
  
  <pre><code>db.collection.update({_id:ObjectID("38289842bbb")},
                       {$set : {field1: {$where :"this.field2.length"}}})
  </code></pre>