Skip to content

Instantly share code, notes, and snippets.

@Jul10l1r4
Created December 26, 2017 02:27
Show Gist options
  • Save Jul10l1r4/8c5b26b0ff7872592f5921dc815a2850 to your computer and use it in GitHub Desktop.
Save Jul10l1r4/8c5b26b0ff7872592f5921dc815a2850 to your computer and use it in GitHub Desktop.
<?php
try{
$mongo = new MongoDB\Driver\Manager();
$query = new mongoDB\Driver\Query([], ['sort' => ['nome' => 1], 'limit' => 5]);
$rows = $mongo->executeQuery("teste.clientes", $query);
foreach($rows as $row){
echo "$row->nome:$row->profissao\n";
}
}catch (MongoDB\Drive\Exception\Exception $e){
echo "fudeu na linha ".$e->getLine()." foi ".$e->getMessage();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment