mongodb - MongoCollection::aggregate() is undefined in Heroku PHP using MongoHQ -
i'm getting following error when using mongodb's aggregate()
function in php code. code works on local setup running mongodb 2.2.3
php fatal error: call undefined method mongocollection::aggregate() in /app/www/page.php on line 52, referer: http://referrer.url
code
foreach($cats $key=>$val){ $cats2[$val['lable']] = $mycollection->aggregate( array( array('$match' => array('user_id' => $user_id )), array('$unwind' =>"\$data"), array('$match' => array('data.category'=> $val['category'])), array('$project' => array('name'=> "\$data.name", 'id'=>"\$data.id")), array('$group' => array('_id'=>'$id', 'name'=> array('$first' =>'$name'))), array('$limit' => 12) )); }
environment
- php on heroku
- mongodb 2.2.4 mongohq add-on
you have phpinfo()
if in version see less 1.3.0
, not work.
go mongo driver page download , add appropriate driver. restart server , work.
Comments
Post a Comment