Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SarasovMatvey opened this issue Jan 31, 2022 · 0 comments
Open

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

SarasovMatvey opened this issue Jan 31, 2022 · 0 comments
Labels

Comments

@SarasovMatvey
Copy link

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.

@SarasovMatvey SarasovMatvey changed the title "Indefined index: ok" when i try to aggregate "Undefined index: ok" when i try to aggregate Jan 31, 2022
@sokil sokil added the bug label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants