Unknown error executing command (empty document returned), when executing aggregate in mongodb using php -
i want group in mongodb: code below:
$m = new mongoclient("localhost"); $c = $m->selectdb("grl_db")->selectcollection("user_tbl"); $data = array ( 'title' => 'this title', 'author' => 'bob', 'posted' => new mongodate, 'pageviews' => 5, 'tags' => array ( 'fun', 'good', 'fun' ), 'comments' => array ( array ( 'author' => 'joe', 'text' => 'this cool', ), array ( 'author' => 'sam', 'text' => 'this bad', ), ), 'other' =>array ( 'foo' => 5, ), ); $d = $c->insert($data, array("w" => 1)); $ops = array( array( '$project' => array( "author" => 1, "tags" => 1, ) ), array('$unwind' => '$tags'), array( '$group' => array( "_id" => array("tags" => '$tags'), "authors" => array('$addtoset' => '$author'), ), ), ); $results = $c->aggregate($ops);
but err occurs:
type: mongoresultexception
message: unknown error executing command (empty document returned)
filename: d:\projects\sns\grl1.0\trunk\src\server\grl\application\models\user_model.php
line number: 195
how can solve problem. please me!!!
the problem php version. aggregate, php version on 5.6.1 think php version may below 5.6. please use xampp higher version.
Comments
Post a Comment