Closed couchdbuser2 closed 14 years ago
Hello,
You're perfectly right. Thank you to report this error to me. Commit e60a90153c9ee75eec13 fixed the bug.
Regards,
Mickael
Thank you for such an easy to use wrapper!
Regards,
thanks couchdbuser2 for the patch. as I am a newbie to couchDB I got stuck.: a database without getting results is useless. you made my day! merry Xmas by the way!
Phew, this issue really popped me out of my socks. couchdbuser2 had some nice bugs in it: $design_doc->id = 'design/all'; id needs an underscore: _id
$design_doc->views = array ( 'by_date' => 'map' => $view_fn); $client->storeDoc($design_doc);
This one won't work (at least with my php version), you have to define map as an array.
here is my version (tested on a couchdb -v 0.10.0 lighttpd 1.4.26 PHP 5.3.2) $design_doc->_id = 'design/all'; $design_doc->language = 'javascript'; $view_fn=array( 'map' => 'function(doc) { emit(doc.timestamp,null); }'); $design_doc->views = array ( 'by_date' => $view_fn ); $client->storeDoc($design_doc); This one works and shows this sourceview in futon: { "_id": "design/all", "_rev": "1-fa2ce68ff2bc648c92ff0502f44e8adb", "language": "javascript", "views": { "by_date": { "map": "function(doc) { emit(doc.timestamp,null); }" } } } This is fine. (PHP hates me, but it's okay ;-)
Hi,
I read http://github.com/dready92/PHP-on-Couch/blob/master/doc/couch_client-view.md to create a view but the section:
$view_fn="function(doc) { emit(doc.timestamp,null); }"; $design_doc->_id = '_design/all'; $design_doc->language = 'javascript'; $design_doc->views = array ( 'by_date',$view_fn); $client->storeDoc($design_doc);
should be:
$view_fn="function(doc) { emit(doc.timestamp,null); }"; $design_doc->_id = '_design/all'; $design_doc->language = 'javascript'; $design_doc->views = array ( 'by_date' => 'map' => $view_fn); $client->storeDoc($design_doc);
otherwise it will not really create a view