I ran this command in rockmongo tools- command and its returning correct values
{
aggregate : "twits",
pipeline : [
{$group : {_id : "$by", num_tutorial : {$sum : 1}}}
]
}
and then I tried to extract the values from it using this
define("__COLLECTION_TWITS__","twits");
in /var/www/html/TradeTwits/require/config/DBConfig.inc.php
$collectionName=__COLLECTION_TWITS__;
$db = $this->connection("mo");
$col = $db->$collectionName;
return $col->aggregate(['$group'=> array('_id' => '$by','num_tutorial' => array($sum => 1))]);
in /var/www/html/TradeTwits/app/models/BaseModel.php
The above code should be returning all records grouped by usernames, but when in php ,it is not working fine.
Am using phalcon framework using PECL class library to access mongodb and rockmongo as GUI for accessing mongodb collection
It is returning correct values for find() count() etc.Should I use another library for aggregate or pipeline?
$sumshould have simple quotes.