Answer the question
In order to leave comments, you need to log in
How to make a selection of records with the latest?
There is a request:
//...
public static function select($filter = [], $options = [])
{
self::connect();
$query = new MongoDB\Driver\Query($filter, $options);
return self::$manager->executeQuery(self::$collection, $query);
}
//...
foreach (MongoDB::select([], ['limit' => 3]) as $frame) {
echo '<p>' . $frame->name . '</p>';
}
$options = ['sort' => ['timestamp' => -1]];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question