dready92 / PHP-on-Couch

Data Access Library to access a CouchDB server with PHP.
http://dready.byethost31.com/index.php/display/view/192
GNU Lesser General Public License v3.0
246 stars 102 forks source link

getAllDocs argument missing #33

Closed haje007 closed 11 years ago

haje007 commented 12 years ago

Documentation says:

To retrieve several documents in one go, knowing their IDs, use the method getAllDocs($ids). $ids is an array of documents IDs. This function acts like a view, so the output is the view output of CouchDB, and you should use "include_docs(TRUE)" to have documents contents.

Example :

$view = $client->include_docs(true)->getAllDocs( array('BlogPost5676','BlogComments5676') ); foreach ( $view->rows as $row ) { echo "doc id :".$row->doc->_id."\n"; }

Core doesn't have an argument.. :

public function getAllDocs ( ) { $url = '/'.urlencode($this->dbname).'/_all_docs'; list($method, $view_query, $data) = $this->_prepare_view_query(); return $this->_queryAndTest ($method, $url, array(200),$view_query,$data); }

dready92 commented 12 years ago

Please point me the documentation file where you saw this. By looking on https://github.com/dready92/PHP-on-Couch/blob/master/doc/couch_client-document.md I read:

"To retrieve several documents in one go, knowing their IDs, select documents using the keys($ids) coupled with the method getAllDocs(). $ids is an array of documents IDs."

shr3k commented 12 years ago

Hi, IMHO correct call is: $view = $client->include_docs(true)->keys($myStringKeysArray)->getAllDocs();

dready92 commented 11 years ago

shr3k: that's right. Thanks :-)