title: MongoDB $addtoSet and $set in the same operation
body: <p>In my Meteor/javascript app, I am trying to update a specific MongoDB document via <code>$addToSet</code> on a certain part of that document followed by <code>$set</code> on a different part of that same document. There is no overlap between these two portions, so from what I read online it should be safe. But I can't seem to get the syntax correct. How can I carry out these two operations in one javascript command? The below works as two separate commands, and I assume it would be faster if they could be combined into just one write to Mongo.</p>
  
  <pre><code>Collection.update(
    {_id: documentId},
    {$addToSet:
      {data:
        {$each: newData}
      }
    }
  );
  Collection.update(
    {_id: documentId},
    {$set:
      {lastTxn: lastTxn,
       updatedAt: new Date()}
    }
  );
  </code></pre>