©
This document uses PHP Chinese website manual Release
(PECL mongo >=0.9.0)
MongoCursor::limit — Limits the number of results returned
$num
)
num
The number of results to return.
Returns this cursor.
Throws MongoCursorException if this cursor has started iterating.
[#1] vinicius at codemakers dot com dot br [2013-12-24 14:49:56]
//Show only unique result
$cursor = $collection->find();
$cursor->limit(1);