I'm using mongodb and laravel to join two collections 'Course' and 'Course Objectives' using lookup but it is giving me error as: "$pipeline is not a list (unexpected index: "$lookup")". The code is:
$data = Course::raw(function($collection){
return $collection->aggregate([
'$lookup' =>[
'from'=> '$course_objectives',
'localField'=> 'id',
'foreignField' => 'course_id',
'as' => 'course_objective',
],
]);
});