$limit

NameUsage TypeDescription

$limit

Number

$limit Operator is used to specify the limitation in the Array Response Return. For example, if we request 2 Writers, it will return us a maximum of 2 Objects.

/* Example Usage */
const model = ...Someone Model

(async () => {

await model.find({},{ $limit: 2 });
/*
[
{id:1, name: 'Paul', surname: 'Grey', age: 5, classNumber: 3, achievements:[]},
{id:2, name: 'Jesse', surname: 'Clean', age: 5, classNumber: 7, achievements:["reading"]},
]
*/

})();

Last updated