Skip to content

Limit

Limit number of found objects

Prefix: limit

Value: Modifier with a number

Can start the pipeline: No

Steps before: find, get, sort, limit, offset

Steps after: find, get, sort, limit, offset, update, delete

Example

Input:

collection|test|:q[
    find[
    ],
    sort[
        asc(value|num|),
    ],
    limit(n|5|),
];

Output:

result:ok[
    response{
        s|data|:objects{
            test|0d28f996-c6cb-4c75-a1c7-3c2a844a316b|:m{
                s|name|:s|test_0|,
                s|num|:n|0|,
            },
            test|7ba4f95d-44f2-4f83-8fc4-d825af767d7b|:m{
                s|name|:s|test_1|,
                s|num|:n|1|,
            },
            test|b6afa3fc-6829-4c94-9105-979dce2324bd|:m{
                s|name|:s|test_2|,
                s|num|:n|2|,
            },
            test|79ea1b39-8e90-45c3-8b45-b122c25a9d53|:m{
                s|num|:n|3|,
                s|name|:s|test_3|,
            },
            test|7aafba5b-17b7-478e-b9b4-79b78f549728|:m{
                s|num|:n|4|,
                s|name|:s|test_4|,
            },
        },
        s|meta|:find_meta{
            s|count|:n|5|,
        },
    },
];