rudiment.js
function(key) {
      var that = this;

      if (!this._key || !key) {
        return Promise.reject(new Error('No unique key specified'));
      }

      var props = {};
      props[this._key] = key;

      return this._dbApi.find(props).then(function(docs) {
        return that._readDoc(docs[0]);
      });
    }
function(key) {
      var that = this;

      if (!this._key || !key) {
        return Promise.reject(new Error('No unique key specified'));
      }

      var props = {};
      props[this._key] = key;

      return this._dbApi.find(props).then(function(docs) {
        return that._readDoc(docs[0]);
      });
    }
function ( key ) { var that = this ; if ( ! this . _key || ! key ) { return Promise . reject ( new Error ( 'No unique key specified' ) ) ; } var props = { } ; props [ this . _key ] = key ; return this . _dbApi . find ( props ) . then ( function ( docs ) { return that . _readDoc ( docs [ 0 ] ) ; } ) ; }
Get a document from the database by key

@param {String} key
@return {Promise}
Get a document from the database by key