"Undefined index: ok" when i try to aggregate
SarasovMatvey opened this issue · 0 comments
SarasovMatvey commented
These error cause when i try to run following code:
$collection = $this->getClient()->getDatabase($this->db)->getCollection('messages');
$pipeline = $collection->createAggregator()->setBatchSize(100)->group(array('_id' => '$channelId', 'sum' => array('$sum' => 1)));
$result = $collection->aggregate($pipeline, array(), false);
I think that error on 1056 line in Sokil\Mongo\Collection.php:
if ($status['ok'] != 1) {
throw new Exception('Aggregate error: ' . $status['errmsg']);
}
If i fetch data as cursor (pass true in third aggregate function parameter) - works fine.