title: MongoDB update multiple rows in a single query
body: <p>I have a collection with the following document</p>
  
  <pre><code>{
     "_id" : 1,
     "item" : "item1",
     "stock" : 184
  }
  {
     "_id" : 2,
     "item" : "item2",
     "stock" : 330
  }
  {
     "_id" : 3,
     "item" : "item3",
     "stock" : 140
  }
  </code></pre>
  
  <p>I want to update this collection like this using a single query.</p>
  
  <pre><code>{
     "_id" : 1,
     "item" : "item1",
     "stock" : 80
  }
  {
     "_id" : 2,
     "item" : "item2",
     "stock" : 60
  }
  {
     "_id" : 3,
     "item" : "item3",
     "stock" : 170
  }
  </code></pre>
  
  <p>I can do it using <code>forEach</code> but I have to update thousands of records at once which will time consuming. So does MongoDB have this functionality?</p>
  
  <p>Your help will be highly appreciated.</p>