略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: MongoCursor::limit

2024-05-05

MongoCursor::limit

(PECL mongo >=0.9.0)

MongoCursor::limitLimits the number of results returned

说明

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

参数

num

The number of results to return.

返回值

Returns this cursor.

错误/异常

Throws MongoCursorException if this cursor has started iterating.

参见

add a note add a note

User Contributed Notes 1 note

up
1
vinicius at codemakers dot com dot br
5 years ago
//Show only unique result

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

官方地址:https://www.php.net/manual/en/mongocursor.limit.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3