title: MongoDB write order Node.js
body: <p>If I had a loop:</p>
  
  <pre><code>for (var i = 0; i &lt;= 100; i++) {
    collection.updateOne(query, {
      $set: {
        number: i
      }
    });
  }
  </code></pre>
  
  <p>would I be guaranteed that the last update sent would be the one stored in the database, or is there a chance that one or more of the updates may arrive out of order?</p>
  
  <p>If updates can arrive out of the order in which they are sent, is there a way to guarantee that the updates arrive in order without waiting for a response from the database between sending each one (would have to be able to work within a synchronous loop).</p>