code: function initDocument (docName) {
    return db.getDocument(dbName, docName)
      .then(response => response.data._rev) // document already exists
      .catch(response => {
        if (response.status === 404) {
          // create new document
          return db.createDocument(dbName, {foo: 'bar'}, docName)
            .then(response => response.data.rev)
        } else {
          // real error
          return Promise.reject(response)
        }
      })
  }
docs: get existing document or create new
  @param  {String} docName
  @return {Promise} - fulfilled with document revision