我想将游标转换为数组,所以我看到游标结果,为此,当我使用 mongodb 的 toArray 时,显示此错误
“致命错误:调用未定义的方法 MongoCursor::toArray()”
这是我的代码:
$getting_started_collection = $this->getServiceLocator()->get('Common\Collection\ResourcesGettingStarted');
$criteria = array(
'$or' => array(
array('affiliate_type' => 'cpl_cpm'),
array('affiliate_type' => 'cpl')
)
);
$columns = array(
'_id' => true,
'title' => true,
'description' => true,
'logo' => true,
'pdf' => true
);
$cursor = $getting_started_collection->fetchAll($criteria, $columns, true);
$data_array = $cursor->toArray();
echo("<pre>");
print_r($data_array);
die();
我如何使用https://docs.mongodb.com/manual/reference/method/cursor.toArray/?