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:
"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.
The property whose value will be compared with rangeStart
and rangeEnd
.
Supported properties:
_createdDate
_updatedDate
The beginning value of the range to match against.
The ending value of the range to match against.
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.
The property whose value will be compared with the string.
Supported property: slug
The string to look for inside the specified property value.
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:
"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.
The properties used in the sort.
Supported properties:
primary
slug
_createdDate
_updatedDate
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.
The property whose value will be compared with the string.
Supported property: slug
The string to look for at the end of the specified property value.
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
.
The property whose value will be compared with value
.
Supported properties:
_id
primary
slug
_createdDate
_updatedDate
The value to match against.
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.
function find(): Promise<PublicPlansQueryResult>;
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;
});
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:
"abc"
is greater than or equal to "ABC"
(because of the greater than),
but "ABC"
is not greater than or equal to "abc"
.
The property whose value will be compared with value
.
Supported properties:
_createdDate
_updatedDate
The value to match against.
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:
"text"
is greater than "Text"
.
The property whose value will be compared with value
.
Supported properties:
_createdDate
_updatedDate
The value to match against.
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"
.
The property whose values will be compared with values
. The property type must be an array of strings.
Supported property: _id
The values to match against.