【发布时间】:2018-09-07 13:03:17
【问题描述】:
我正在使用来自 link 的 mongoDB 库和 CI。我想加入两个表,所以我发现可以使用 lookup
我正在使用下面的代码
$this->load->library('mongo_db',array('activate' => 'default'),'mongo_db');
$res = $this->mongo_db->aggregate(
'firstTable',
array(
'$lookup' => array(
'from' => 'secondTable',
'localField' => '_id',
'foreignField' => 'foreignKey',
'as' => 'user',
)
));
echo '<pre>'; print_r($res);
它给出了错误
Aggregation operation failed: localhost:27017: The 'cursor' option is required, except for aggregate with the explain argument
在这种情况下如何添加光标
我检查了其他类似的答案,但没有得到在这种情况下如何添加光标
【问题讨论】:
-
@MohitKumarBordia : 函数 aggregateCursor 不在我正在使用的库中
-
试试下面提到的链接
标签: php mongodb codeigniter