title: create and update multiple MongoDB documents in one call
body: <p>Let's imagine that I have a MongoDB collection like so: </p>
  
  <pre><code>[
  {someId: 1, someProp: prop1, isOpen: true},
  {someId: 2, someProp: prop1, isOpen: true},
  {someId: 3, someProp: prop1, isOpen: true},
  {someId: 4, someProp: prop1, isOpen: true},
  ]
  </code></pre>
  
  <p>I want to make a call to it with an array of objects, but some of these objects will be new, and some will need to override existing documents. </p>
  
  <p>So let's say my array looks like this: </p>
  
  <pre><code>[
  {someId: 1, someProp: prop1, isOpen: true},
  {someId: 2, someProp: prop1, isOpen: true},
  {someId: 5, someProp: prop1, isOpen: true},
  {someId: 6, someProp: prop1, isOpen: true},
  ]
  </code></pre>
  
  <p>How do I write a MongoDB query that does the following.</p>
  
  <p>If <code>someId</code> matches an object in my second array, just change the <code>isOpen</code> to <code>false</code>. 
  If <code>someId</code> doesn't match any objects then insert them into collection. </p>
  
  <p>So after I run my query i would end up with: </p>
  
  <pre><code>[
  {someId: 1, someProp: prop1, isOpen: false},
  {someId: 2, someProp: prop1, isOpen: false},
  {someId: 3, someProp: prop1, isOpen: true},
  {someId: 4, someProp: prop1, isOpen: true},
  {someId: 5, someProp: prop1, isOpen: true},
  {someId: 6, someProp: prop1, isOpen: true},
  ]
  </code></pre>
  
  <p>Is it a good idea to call a <code>forEach()</code> and just use: </p>
  
  <pre><code>db.books.update(
     { item: "ZZZ135" },
     {
       item: "ZZZ135",
       stock: 5,
       tags: [ "database" ]
     },
     { upsert: true }
  )
  </code></pre>
  
  <p>...in the loop? Probably not. That would mean multiple calls to the db. Is there a more efficient way of doing that? </p>