code: function insertAttachmentMappings(docInfo, seq, callback) {
  
      var attsAdded = 0;
      var attsToAdd = Object.keys(docInfo.data._attachments || {});
  
      if (!attsToAdd.length) {
        return callback();
      }
  
      function checkDone() {
        if (++attsAdded === attsToAdd.length) {
          callback();
        }
      }
  
      function add(att) {
        var digest = docInfo.data._attachments[att].digest;
        var req = attachAndSeqStore.put({
          seq: seq,
          digestSeq: digest + '::' + seq
        });
  
        req.onsuccess = checkDone;
        req.onerror = function (e) {
          // this callback is for a constaint error, which we ignore
          // because this docid/rev has already been associated with
          // the digest (e.g. when new_edits == false)
          e.preventDefault(); // avoid transaction abort
          e.stopPropagation(); // avoid transaction onerror
          checkDone();
        };
      }
      for (var i = 0; i < attsToAdd.length; i++) {
        add(attsToAdd[i]); // do in parallel
      }
    }
docs: map seqs to attachment digests, which we will need later during compaction