title: MongodDB $pull only one element from array
body: <p>I have a document with an array inside, like this:</p>
  
  <pre><code>"userTags" : [
          "foo",
          "foo",
          "foo",
          "foo",
          "moo",
          "bar"
      ]
  </code></pre>
  
  <p>If I perform <code>db.products.update({criteriaToGetDocument}, {$push: {userTags: "foo"}}}</code> I can correctly insert another instance of <code>foo</code> into the array.</p>
  
  <p>However, if I do <code>db.products.update({criteriaToGetDocument}, {$pull: {userTags: "foo"}}}</code> then it removes <em>all</em> instances of <code>foo</code> from the array, leaving me with:</p>
  
  <pre><code>"userTags" : [
          "moo",
          "bar"
      ]
  </code></pre>
  
  <p>This won't do at all, I only want to pull one item from the array rather than all of them. How can I alter the command so that only one <code>foo</code> is removed? Is there some sort of <code>$pullOnce</code> method that can work here?</p>