Search...
limit( )
Limits the number of items the query returns.
Description
Syntax
function limit(limit: string): LabelsQueryBuilder
limit Parameters
NAME
TYPE
DESCRIPTION
Was this helpful?
Add a
limit
to a queryCopy Code
1const query = contacts.queryLabels().limit(10);
Create a query, add a
limit
, and run itCopy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { contacts } from 'wix-crm-backend';34export const myQueryLabelsFunction = webMethod(Permissions.Anyone, () => {5 return contacts.queryLabels()6 .limit(10)7 .find()8 .then((results) => {9 if (results.items.length > 0) {10 const items = results.items;11 const firstItem = items[0];12 const pageSize = results.pageSize;13 const hasNext = results.hasNext();14 const hasPrev = results.hasPrev();15 const length = results.length;16 const query = results.query;1718 return items;19 } else {20 // Handle case where no matching items found21 }22 })23 .catch((error) => {24 console.error(error);25 });2627});