alcaeus / mongo-php-adapter

:link: Adapter to provide ext-mongo interface on top of mongo-php-library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Data returned in incorrect format

mynthon opened this issue · comments

this code, using mongo 3.6.18
$aggData = $coll->aggregate([['$match' => ['photo.id' => ['$in' => array_values($this->_ids)]]], ['$group' => ['_id' => '$photo.id', 'count' => ['$sum' => 1]]]], array('cursor' => array('batchSize' => PHP_INT_MAX)));

in PHP5.6 returned data in format:

[...
'cursor'=>['firstBatch'=>...]
]

while this mongo adapter in php7.4 returns:

[
                'ok' => 1.0,
                'result' => ...,
                'waitedMS' => 0,
];

There are various tests that ensure the polyfill methods return the same value as the original. Please provide a testcase (see other test cases in MongoCollectionTest that passes on PHP 5.6 with the legacy MongoDB extension, but fails when ran with the adapter and I'll take a look.