//Show only unique result
$cursor = $collection->find();
$cursor->limit(1);
PHP - Manual: MongoCursor::limit
2024-12-24
(PECL mongo >=0.9.0)
MongoCursor::limit — Limits the number of results returned
num
The number of results to return.
Returns this cursor.
Throws MongoCursorException if this cursor has started iterating.
//Show only unique result
$cursor = $collection->find();
$cursor->limit(1);