Skip to content

"Undefined index: ok" when i try to aggregate #181

@SarasovMatvey

Description

@SarasovMatvey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions