Skip to navigation
How to count all docs in couchdb and fetch them from php
26.11.16
the view: Map: function(doc) { emit(1,1); } Reduce: _sum PHP-on-Couch php example: $this->config->load('couchdb', TRUE); $this->c = $this->config->item('couch', 'couchdb'); $this->load->library('couchdb', ['couch_dsn'=>$this->c["couch_dsn"],'couch_database'=>'asset'],'asset'); try { return $this->asset->reduce('true')->getView('count','all')->rows[0]->value; } catch ( Exception $e ) { return 110000; }
https://github.com/dready92/PHP-on-Couch/blob/master/doc/couch_client-view.md
Reply
Anonymous
Information Epoch 1779187848
Save trees.
Home
Notebook
Contact us