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
Post a Comment