title: PouchDB gives 409 "Document update conflict" error with .put(), even with correct ._rev
body: <p>I have a function that may either create or update documents in PouchDB, as follows. The function works perfectly when run the first time. However, every subsequent run yields a 409 error, even though the ._rev property appears to be correct. </p>
  
  <pre><code>function saveEventMatchesToDatabase(event, db) {
      /* event: An event object from The Blue Alliance API. */
      /* db: a reference ot the PouchDB database. */
  
      /* Purpose: Given an event, extract the list of matches and teams, and save them to the database. */
      TBA.event.matches(event.key, function(matches_list) {
          var i = 0;
          for (i = 0; i &lt; matches_list.length; i++) {
              var match = new Object();
              var docrec = new Object();
  
              match._id = 'matches/' + matches_list[i].key;
              match.redTeam = matches_list[i].alliances.red.teams;
              match.blueTeam = matches_list[i].alliances.blue.teams;
  
              /* If the doc already exists, we need to add the _rev to update the existing doc. */
              db.get(match._id).then(function(doc) {
                  match._rev = doc._rev;
                  docrec = doc;
              }).catch(function(err) {
                  if ( err.status != 404 ) {
                      /* Ignore 404 errors: we expect them, if the doc is new. */
                      console.log(err);
                  }
              });
  
              db.put(match).then(function() {
                  // Success!
              }).catch(function(err) {
                  console.log('\ndoc._rev: ' + docrec._rev);
                  console.log('match._rev: ' + match._rev);
                  console.log(err);
              });
          }
      });
  }
  </code></pre>
  
  <p>Sample console output from running this function the second time is below. The same error occurs for EVERY item in match_list, not just intermittently.</p>
  
  <pre><code>doc._rev: 1-7cfa2c6245dd939d8489159d8ca674d9
  match._rev: 1-7cfa2c6245dd939d8489159d8ca674d9
  r {status: 409, name: "conflict", message: "Document update conflict", error: true}
  </code></pre>
  
  <p>I'm not sure what I'm missing, that's causing this problem. Any suggestions for where to look next would be greatly appreciated.</p>