$myCollection = $con->Database_name->Collection1;
$ops = array(
array(
"$lookup" => array(
"from" => "Collection2",
"localField" => "Collection1.field",
"foreignField" => "Collection2.field",
"as" => "Name of Alias"
)
)
);
$results = $myCollection->aggregate($ops);
var_dump($results);
I am using 3.6 version of mongodb and 5.6 of PHP. the same query I am running in mongodb shell, there it is working but in php it is occuring error.
Below is the complete error:
Fatal error: Uncaught exception 'MongoResultException' with message 'localhost:27017: The 'cursor' option is required, except for aggregate with the explain argument'