Monday, 10 September 2018

Aggregation operation failed: localhost:27017: The 'cursor' option is required, except for aggregate with the explain argument

I am using mongoDB library from link with CI. I want to join two tables so I found it can be done using lookup

I am using below code for it

$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);

It gives error as

Aggregation operation failed: localhost:27017: The 'cursor' option is required, except for aggregate with the explain argument

How I can add cursor in this case

I checked other similar answers but not getting how I can add cursor in this case



from Aggregation operation failed: localhost:27017: The 'cursor' option is required, except for aggregate with the explain argument

No comments:

Post a Comment