# constructing a to a remote server and querry and limiting the result to the latest 3 results
$username ="yourusername";
$password = "yourpasswort";
$manager = new MongoDB\Driver\Manager("mongodb://yourserver.com/",
array("username" => $username, "password" => $password )
);
# setting your options and filter
$filter = [];
$options = ['sort'=>array('_id'=>-1),'limit'=>3]; # limit -1 from newest to oldest
#constructing the querry
$query = new MongoDB\Driver\Query($filter, $options);
#executing
$cursor = $manager->executeQuery('resultdb.test', $query);
echo "dumping results<br>";
foreach ($cursor as $document) {
var_dump($document);
}