public function read($query, array $options = []) {
		$defaults = ['return' => 'resource', 'model' => $query->model()];
		$options += $defaults;
		$params = compact('query', 'options');

		return Filters::run($this, __FUNCTION__, $params, function($params) {
			$query = $params['query'];
			$params = $query->export($this);

			list($_path, $conditions) = (array) $params['conditions'];
			$model = $query->model();

			if (empty($_path)) {
				$_path = '_all_docs';
				$conditions['include_docs'] = 'true';
			}
			$path = "{$this->_config['database']}/{$_path}";
			$args = (array) $conditions + (array) $params['limit'] + (array) $params['order'];

			$result = $this->connection->get($path, $args);
			$result = is_string($result) ? json_decode($result, true) : $result;

			$data = $stats = [];

			if (isset($result['_id'])) {
				$data = [$result];
			} elseif (isset($result['rows'])) {
				$data = $result['rows'];
				unset($result['rows']);
				$stats = $result;
			}
			$stats += ['total_rows' => null, 'offset' => null];
			$opts = compact('stats') + [
				'class' => 'set', 'exists' => true, 'defaults' => false
			];

			return $this->item($model, $data, $opts);
		});
	}
public function read($query, array $options = []) {
		$defaults = ['return' => 'resource', 'model' => $query->model()];
		$options += $defaults;
		$params = compact('query', 'options');

		return Filters::run($this, __FUNCTION__, $params, function($params) {
			$query = $params['query'];
			$params = $query->export($this);

			list($_path, $conditions) = (array) $params['conditions'];
			$model = $query->model();

			if (empty($_path)) {
				$_path = '_all_docs';
				$conditions['include_docs'] = 'true';
			}
			$path = "{$this->_config['database']}/{$_path}";
			$args = (array) $conditions + (array) $params['limit'] + (array) $params['order'];

			$result = $this->connection->get($path, $args);
			$result = is_string($result) ? json_decode($result, true) : $result;

			$data = $stats = [];

			if (isset($result['_id'])) {
				$data = [$result];
			} elseif (isset($result['rows'])) {
				$data = $result['rows'];
				unset($result['rows']);
				$stats = $result;
			}
			$stats += ['total_rows' => null, 'offset' => null];
			$opts = compact('stats') + [
				'class' => 'set', 'exists' => true, 'defaults' => false
			];

			return $this->item($model, $data, $opts);
		});
	}
public function read ( $ query , array $ options = [ ] ) { $ defaults = [ 'return' => 'resource' , 'model' => $ query -> model ( ) ] ; $ options += $ defaults ; $ params = compact ( 'query' , 'options' ) ; return Filters :: run ( $ this , __FUNCTION__ , $ params , function ( $ params ) { $ query = $ params [ 'query' ] ; $ params = $ query -> export ( $ this ) ; list ( $ _path , $ conditions ) = ( array ) $ params [ 'conditions' ] ; $ model = $ query -> model ( ) ; if ( empty ( $ _path ) ) { $ _path = '_all_docs' ; $ conditions [ 'include_docs' ] = 'true' ; } $ path = "{$this->_config['database']}/{$_path}" ; $ args = ( array ) $ conditions + ( array ) $ params [ 'limit' ] + ( array ) $ params [ 'order' ] ; $ result = $ this -> connection -> get ( $ path , $ args ) ; $ result = is_string ( $ result ) ? json_decode ( $ result , true ) : $ result ; $ data = $ stats = [ ] ; if ( isset ( $ result [ '_id' ] ) ) { $ data = [ $ result ] ; } elseif ( isset ( $ result [ 'rows' ] ) ) { $ data = $ result [ 'rows' ] ; unset ( $ result [ 'rows' ] ) ; $ stats = $ result ; } $ stats += [ 'total_rows' => null , 'offset' => null ] ; $ opts = compact ( 'stats' ) + [ 'class' => 'set' , 'exists' => true , 'defaults' => false ] ; return $ this -> item ( $ model , $ data , $ opts ) ; } ) ; }
Read from document.

@param string $query
@param array $options
@return object
@filter
Read from document .