PHP Velho Oeste 2024

MongoCursor::limit

(PECL mongo >=0.9.0)

MongoCursor::limit返す結果の数を制限する

説明

public MongoCursor::limit ( int $num ) : MongoCursor

パラメータ

num

返したい結果の数。

返り値

このカーソルを返します。

エラー / 例外

このカーソルの反復処理が始まっている場合に MongoCursorException をスローします。

参考

add a note add a note

User Contributed Notes 1 note

up
6
vinicius at codemakers dot com dot br
10 years ago
//Show only unique result

$cursor = $collection->find();
$cursor->limit(1);
To Top