Search...
limit( )
Limits the number of items the query returns.
Description
Syntax
function limit(limit: string): ContactsQueryBuilder
limit Parameters
NAME
TYPE
DESCRIPTION
Returns
A ContactsQueryBuilder
object that contains the refined query.
Return Type:
Was this helpful?
Add a
limit
to a queryCopy Code
1const query = contacts.queryContacts().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 myQueryContactsFunction = webMethod(Permissions.Anyone, () => {56 return contacts.queryContacts()7 .limit(10)8 .find()9 .then((results) => {10 if (results.items.length > 0) {11 const items = results.items;12 const firstItem = items[0];13 const pageSize = results.pageSize;14 const hasNext = results.hasNext();15 const hasPrev = results.hasPrev();16 const length = results.length;17 const query = results.query;1819 return items;20 } else {21 // Handle case where no matching items found22 }23 })24 .catch((error) => {25 console.error(error);26 })2728});