code: function writeLock(fun) {
      return getArguments(function (args) {
        db._queue.push({
          fun: fun,
          args: args,
          type: 'write'
        });
  
        if (db._queue.length === 1) {
          pouchdbUtils.nextTick(executeNext);
        }
      });
    }
docs: all read/write operations to the database are done in a queue, similar to how websql/idb works. this avoids problems such as e.g. compaction needing to have a lock on the database while it updates stuff. in the future we can revisit this.