Home  >  Article  >  Backend Development  >  在MongoDB中怎么读取指定数量的数据记录

在MongoDB中怎么读取指定数量的数据记录

PHPz
PHPzOriginal
2016-06-06 20:43:492278browse

在MongoDB中可以使用Limit方法读取指定数量的数据记录,其语法是“>db.COLLECTION_NAME.find().limit(NUMBER)”,参数“NUMBER”表示从MongoDB中读取的记录条数。

在MongoDB中怎么读取指定数量的数据记录

在MongoDB中怎么读取指定数量的数据记录?

MongoDB Limit() 方法

如果你需要在MongoDB中读取指定数量的数据记录,可以使用MongoDB的Limit方法,limit()方法接受一个数字参数,该参数指定从MongoDB中读取的记录条数。

语法

limit()方法基本语法如下所示:

>db.COLLECTION_NAME.find().limit(NUMBER)

更多相关技术文章,请访问PHP中文网

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn