//Show only unique result
$cursor = $collection->find();
$cursor->limit(1);
PHP - Manual: MongoCursor::limit
2025-10-31
(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.
 add a note
 add a note
  
//Show only unique result
$cursor = $collection->find();
$cursor->limit(1);