php - How can I set "allowDiskUse" option in aggregation method -



php - How can I set "allowDiskUse" option in aggregation method -

how can set allowdiskuse alternative in aggregation method in php? have tried next without success:

$out = $dbnew->$a->aggregate( array('$match' => $filter_array), array('$sort' => $sorting), array('$skip' => $start), array('$allowdiskuse' => true));

you providing options in wrong place. need utilize this:

public array mongocollection::aggregate ( array $pipeline [, array $options ] )

and providing pipeline list of arrays, doing:

public array mongocollection::aggregate ( array $op [, array $op [, array $... ]] )

take in mind need @ to the lowest degree 1.5.0 version of php driver.

so define pipeline , options:

$pipeline = array( array('$match' => $filter_array), array('$sort' => $sorting), ... ); $options = array("allowdiskuse" => true);

and utilize it:

$out = $dbnew->$a->aggregate($pipeline, $options);

php mongodb

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -