between( )


Refines a query to match items whose specified property value is within a specified range.

The between() function refines a PublicPlansQueryBuilder to only match items where the value of the specified property is greater than or equal to rangeStart and less than rangeEnd.

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. When sorting, ascending order is: numbers, followed by symbols, and then letters.

The following types of properties can be compared:

  • Number: Compares numerically.
  • Date: Compares JavaScript Date objects.
  • String: Compares lexicographically, so
    • "A" and "M" are between "A" and "Z", but "a", "m", "z" and "Z" are not.
    • "A", "M", "Z", and "a" are between "A" and "z", but "z" is not.
Method Declaration
Copy
Method Parameters
propertyNamestringRequired

The property whose value will be compared with rangeStart and rangeEnd.

Supported properties:

  • _createdDate
  • _updatedDate

rangeStartunionRequired

The beginning value of the range to match against.


rangeEndunionRequired

The ending value of the range to match against.

Returns
JavaScript
Did this help?

contains( )


Refines a query to match items whose specified property value contains a specified string.

The contains() function refines a PublicPlansQueryBuilder to only match items where the value of the specified property contains the specified string. Matching with contains() is case-sensitive, so "TEXT" does not contain "text".

You can only use contains() with a property whose value is a String.

Method Declaration
Copy
Method Parameters
propertyNamestringRequired

The property whose value will be compared with the string.

Supported property: slug


stringstringRequired

The string to look for inside the specified property value.

Returns
JavaScript
Did this help?

descending( )


Adds a sort to a query or sort, sorting by the specified properties in descending order.

The descending() function refines a PublicPlansQueryBuilder to sort in descending order of the specified properties. If you specify more than one property, descending() sorts the results in descending order by each property in the order they are listed.

You can sort the following types:

  • Number: Sorts numerically.
  • Date: Sorts by date and time.
  • String: Sorts lexicographically, so "abc" comes before "XYZ".

If a property contains a number as a String, that value will be sorted alphabetically and not numerically. Items that do not have a value for the specified sort property are ranked lowest. When sorting, ascending order is: numbers, followed by symbols, and then letters.

Method Declaration
Copy
Method Parameters
propertyNameArray<string>Required

The properties used in the sort.

Supported properties:

  • primary
  • slug
  • _createdDate
  • _updatedDate
Returns
JavaScript
Did this help?

endsWith( )


Refines a query to match items whose specified property value ends with a specified string.

The endsWith() function refines a PublicPlansQueryBuilder to only match items where the value of the specified property ends with the specified string. Matching with endsWith() is case-sensitive, so "TEXT" does not end with "ext".

You can only use endsWith() with a property whose value is a String.

Method Declaration
Copy
Method Parameters
propertyNamestringRequired

The property whose value will be compared with the string.

Supported property: slug


stringstringRequired

The string to look for at the end of the specified property value.

Returns
JavaScript
Did this help?

eq( )


Refines a query to match items whose specified property value equals the specified value.

The eq() function refines a PublicPlansQueryBuilder to only match items where the value of the specified property equals 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 eq() is case sensitive, so "text" is not equal to "Text".

If the value of the propertyName property is an Array, eq() includes items in which any 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
  • primary
  • slug
  • _createdDate
  • _updatedDate

valueanyRequired

The value to match against.

Returns
JavaScript
Did this help?

find( )


Returns the items that match the query.

The find() function returns a Promise that resolves to the results found by the query and some information about the results. The Promise is rejected if find() is called with incorrect permissions or if any of the functions used to refine the query are invalid.

Method Declaration
Copy
function find(): Promise<PublicPlansQueryResult>;
Request
This method does not take any parameters
Returns
Return Type:Promise<PublicPlansQueryResult>
Perform a find on a query
JavaScript
import wixPricingPlansBackend from "wix-pricing-plans-backend"; // ... wixPricingPlansBackend .queryPublicPlans() .find() .then((results) => { if (results.items.length > 0) { const items = results.items; const firstItem = items[0]; const totalCount = results.totalCount; const pageSize = results.pageSize; const currentPage = results.currentPage; const totalPages = results.totalPages; const hasNext = results.hasNext(); const hasPrev = results.hasPrev(); const length = results.length; const query = results.query; } else { // handle case where no matching items found } }) .catch((error) => { const queryError = error; });
Did this help?

ge( )


Refines a query to match items whose specified property value is greater than or equal to the specified value.

The ge() function refines a PublicPlansQueryBuilder to only match items where the value of the specified property is greater than or equal to 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. When sorting, ascending order is: numbers, followed by symbols, and then letters.

The following types of properties can be compared:

  • Number: Compares numerically.
  • Date: Compares JavaScript Date objects.
  • String: Compares lexicographically, so "abc" is greater than or equal to "ABC" (because of the greater than), but "ABC" is not greater than or equal to "abc".
Method Declaration
Copy
Method Parameters
propertyNamestringRequired

The property whose value will be compared with value.

Supported properties:

  • _createdDate
  • _updatedDate

valueunionRequired

The value to match against.

Returns
JavaScript
Did this help?

gt( )


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

The gt() function refines a PublicPlansQueryBuilder to only match items where the value of the specified property is greater 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. When sorting, ascending order is: numbers, followed by symbols, and then letters.

The following types of properties can be compared:

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

The property whose value will be compared with value.

Supported properties:

  • _createdDate
  • _updatedDate

valueunionRequired

The value to match against.

Returns
JavaScript
Did this help?

hasSome( )


Refines a query to match items whose specified property contains any of the specified value parameters.

The hasSome() function refines a PublicPlansQueryBuilder to only match items where any of the values of the array of the specified property equal any of the specified values.

Matching strings with hasSome() is case sensitive, so "text" is not equal to "Text".

Method Declaration
Copy
Method Parameters
propertyNamestringRequired

The property whose values will be compared with values. The property type must be an array of strings. Supported property: _id


valuesArray<string>Required

The values to match against.

Returns
JavaScript
Did this help?