0
I created a connection with mongodb and created a session from it:
$manager = new MongoDB\Driver\Manager("mongodb://127.0.0.1:27017");
$sessao = $manager->startSession();
$id_sessao = $sessao->getLogicalSessionId();
In the code above I know that the session was created successfully, because if I have the $id_sessao object printed, the id is shown. But now I want to execute a "find()" in this session. That’s why I’m trying to extract the "server" to try to execute in it the command "find":
$busca_vendas = new MongoDB\Driver\Command(['find'=>'vendas','query'=>[]]);
$cursor = $sessao->getServer()->executeCommand("loja",$busca_vendas);
However, in the above code, the getServer() function returns NULL. Dai I can’t run FIND inside the session. I’m doing it right?