title: Meteor/Mongo: Finding and updating certain elements in a collection
body: <p>I'm starting off with Meteor and need some help with Mongo. I have a collection of names that I'm displaying on a list and want to be able to update one variable of certain entries in the database based on other criteria. Basically what I want to do is:</p>
  
  <p>For every entry where characteristic A = true and B = true, change characteristic C to be false.</p>
  
  <p>So far, I've been trying to figure out how Mongo can handle a "for each" loop over the elements of the collection, and for each element check if conditions A and B hold, and then collection.update(element, {C: false}). This is proving to be a lot more problematic than I thought. I want to do something like this (using dummy variable names):</p>
  
  <pre><code>for (i = 0; i &lt; collection.find().count(); i++){
      if (collection[i].A===true &amp;&amp; collection[i].B===true)
          collection.update(collection[i], {$set: {C: false}});
  };
  </code></pre>
  
  <p>I've been changing this base code around, but am starting to sense that I'm missing something basic about indexing/how collections work in Mongo. Can you index a collection like this (and if so, is this even the most convenient way to do what I'm trying to do?)?</p>