public function update($query, array $options = []) {
		$params = compact('query', 'options');

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

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

			foreach (['id', 'rev'] as $key) {
				$data["_{$key}"] = isset($data[$key]) ? (string) $data[$key] : null;
				unset($data[$key]);
			}
			$data = (array) $conditions + array_filter((array) $data);

			$retry = false;
			do {
				$result = $this->connection->put(
					"{$this->_config['database']}/{$_path}",
					$data,
					['type' => 'json']
				);
				$result = is_string($result) ? json_decode($result, true) : $result;
				$retry = $retry ? !$retry : $this->_autoBuild($result);
			} while ($retry);

			if (isset($result['_id']) || (isset($result['ok']) && $result['ok'] === true)) {
				$result = $this->_format($result, $options);
				$query->entity()->sync($result['id'], ['rev' => $result['rev']]);
				return true;
			}
			if (isset($result['error'])) {
				$query->entity()->errors([$result['error']]);
			}
			return false;
		});
	}
public function update($query, array $options = []) {
		$params = compact('query', 'options');

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

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

			foreach (['id', 'rev'] as $key) {
				$data["_{$key}"] = isset($data[$key]) ? (string) $data[$key] : null;
				unset($data[$key]);
			}
			$data = (array) $conditions + array_filter((array) $data);

			$retry = false;
			do {
				$result = $this->connection->put(
					"{$this->_config['database']}/{$_path}",
					$data,
					['type' => 'json']
				);
				$result = is_string($result) ? json_decode($result, true) : $result;
				$retry = $retry ? !$retry : $this->_autoBuild($result);
			} while ($retry);

			if (isset($result['_id']) || (isset($result['ok']) && $result['ok'] === true)) {
				$result = $this->_format($result, $options);
				$query->entity()->sync($result['id'], ['rev' => $result['rev']]);
				return true;
			}
			if (isset($result['error'])) {
				$query->entity()->errors([$result['error']]);
			}
			return false;
		});
	}
public function update ( $ query , array $ options = [ ] ) { $ params = compact ( 'query' , 'options' ) ; return Filters :: run ( $ this , __FUNCTION__ , $ params , function ( $ params ) { $ query = $ params [ 'query' ] ; $ options = $ params [ 'options' ] ; $ params = $ query -> export ( $ this ) ; list ( $ _path , $ conditions ) = ( array ) $ params [ 'conditions' ] ; $ data = $ query -> data ( ) ; foreach ( [ 'id' , 'rev' ] as $ key ) { $ data [ "_{$key}" ] = isset ( $ data [ $ key ] ) ? ( string ) $ data [ $ key ] : null ; unset ( $ data [ $ key ] ) ; } $ data = ( array ) $ conditions + array_filter ( ( array ) $ data ) ; $ retry = false ; do { $ result = $ this -> connection -> put ( "{$this->_config['database']}/{$_path}" , $ data , [ 'type' => 'json' ] ) ; $ result = is_string ( $ result ) ? json_decode ( $ result , true ) : $ result ; $ retry = $ retry ? ! $ retry : $ this -> _autoBuild ( $ result ) ; } while ( $ retry ) ; if ( isset ( $ result [ '_id' ] ) || ( isset ( $ result [ 'ok' ] ) && $ result [ 'ok' ] === true ) ) { $ result = $ this -> _format ( $ result , $ options ) ; $ query -> entity ( ) -> sync ( $ result [ 'id' ] , [ 'rev' => $ result [ 'rev' ] ] ) ; return true ; } if ( isset ( $ result [ 'error' ] ) ) { $ query -> entity ( ) -> errors ( [ $ result [ 'error' ] ] ) ; } return false ; } ) ; }
Update document.

@param string $query
@param array $options
@return boolean
@filter
Update document .