limit( )


Limits the number of items the query returns.

The limit() function defines the number of results a query returns in each page. Only one page of results is retrieved at a time. The next() and prev() functions are used to navigate the pages of a query result.

By default, limit is set to 50.

The maximum value that limit() can accept is 1000.

Method Declaration
Copy
Method Parameters
limitstringRequired

Limit the number of items to return, which is also the pageSize of the results object.

Returns
JavaScript
Did this help?

lt( )


Refines a query to match items whose specified property value is less than the specified value.

The lt() function refines a ContactsQueryBuilder to only match items where the value of the specified property is less than the specified value.

It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.

If a property contains a number as a String, that value will be compared alphabetically and not numerically. Items that do not have a value for the specified property are ranked lowest.

The following types of properties can be compared:

  • Number: Compares numerically.
  • Date: Compares JavaScript Date objects.
  • String: Compares lexicographically, so "Text" is less than "text".
Method Declaration
Copy
Method Parameters
propertyNamestringRequired

The property whose value will be compared with value.

Supported properties:

  • "_createdDate"
  • "_updatedDate"
  • "lastActivity.activityDate"
  • "info.birthdate"

valueDateRequired

The value to match against.

Returns
JavaScript
Did this help?

ne( )


Refines a query to match items whose specified property value does not equal the specified value.

The ne() function refines a ContactsQueryBuilder to only match items where the value of the specified property does not equal the specified value.

It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.

Matching strings with ne() is case sensitive in most instances, so "text" is not equal to "Text". One exception is email fields, which are case insensitive when matching with ne().

If the value of the propertyName property is an Array, ne() includes items in which none of the elements of the Array match the specified value.

Method Declaration
Copy
Method Parameters
propertyNamestringRequired

The property whose value will be compared with value.

Supported properties:

  • "_id"
  • "_createdDate"
  • "_updatedDate"
  • "lastActivity.activityDate"
  • "primaryInfo.email"
  • "primaryInfo.phone"
  • "info.name.first"
  • "info.name.last"
  • "info.emails.email"
  • "info.phones.phone"
  • "info.addresses.street"
  • "info.addresses.city"
  • "info.addresses.subdivision"
  • "info.addresses.country"
  • "info.company"
  • "info.jobTitle"
  • "info.birthdate"
  • "info.locale"

valueanyRequired

The value to match against.

Returns
JavaScript
Did this help?

not( )


Adds an not condition to the query.

The not() function adds a not condition to a ContactsQueryBuilder. A query with a not returns all the items that match the query as defined up to the not function, but don't match the query passed to the not function.

If the query only contains a not() function, it returns all the items that don't match the query defined by the not method.

Method Declaration
Copy
Method Parameters

Contains functionality for refining a contacts query. The ContactsQueryBuilder functions enable you to run, sort, filter, and control which results a query returns.

Typically, you build a query using queryContacts() function, refine the query by chaining ContactsQueryBuilder functions, and then execute the query by chaining the find() function.

Returns
JavaScript
Did this help?

or( )


Adds an or condition to the query.

The or() function adds an inclusive or condition to a ContactsQueryBuilder. A query with an or returns all the items that match the query as defined up to the or function, the items that match the query passed to the or function, and the items that match both.

The or() function is designed to work with 2 or more queries. If you use it on its own, it will return all the items that meet the query criteria.

Method Declaration
Copy
function or(query: ContactsQueryBuilder): ContactsQueryBuilder;
Method Parameters

A query to add to the initial query as an or condition.

Returns
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myQueryContactsFunction = webMethod(Permissions.Anyone, () => { return contacts .queryContacts() .eq("info.addresses.country", "GB") .or(contacts.queryContacts().eq("info.addresses.country", "FR")) .find() .then((results) => { if (results.items.length > 0) { const items = results.items; const firstItem = items[0]; const pageSize = results.pageSize; const hasNext = results.hasNext(); const hasPrev = results.hasPrev(); const length = results.length; const query = results.query; return items; } else { // Handle case where no matching items found } }) .catch((error) => { console.error(error); }); });
Did this help?