Creates a query to retrieve a list of Wix events.
The queryEvents()
function builds a query to retrieve a list of Wix events and returns
a EventsQueryBuilder object.
The returned object contains the query definition which is typically used to run the query
using the find()
function.
You can refine the query by chaining EventsQueryBuilder
functions onto the query. EventsQueryBuilder
functions enable you to sort, filter, and control the results that queryEvents.find()
returns.
The query runs with the following EventsQueryBuilder
defaults that you can override:
limit
: 50
descending
: _createdDate
The functions that are chained to queryEvents()
are applied in the order they are called. For example,
if you sort on the _createdDate
property in ascending order and then on the status
property in
descending order, the results are sorted first by the created date of the items and then, if there are
multiple results with the same date, the items are sorted by status in descending order, per created date value.
The following EventsQueryBuilder
functions are supported for queryEvents()
.
For a full description of the Wix Event object, see the object returned for the items
property in EventsQueryResult
.
Property | Supported Filters & Sorting |
---|---|
_id | eq() , ne() , hasSome() |
title | eq() , ne() , lt() , le() , gt() , ge() , hasSome() , contains() ,ascending() , descending() |
status | eq() , ne() , hasSome() , contains() |
createdBy | eq() , ne() , hasSome() |
scheduling.startDate | lt() , le() , gt() , ge() , ascending() , descending() |
scheduling.endDate | lt() , le() , gt() , ge() , ascending() , descending() |
_createdDate | ascending() , descending() |
_updatedDate | ascending() , descending() |
slug | eq() , ne() , lt() , le() , gt() , ge() , hasSome() , contains() , ascending() , descending() |
You can only use one filter function for each property. If a property is used in more than one filter, only the first filter will work.
Notes:
suppressAuth
is set to true
in the queryOptions for the find()
function.queryEvents()
function immediately following a change to your Wix events, the data retrieved may not contain your most recent changes. See Wix-data and Eventual Consistency for more information. To solve this problem, you can use the setTimeout()
function to delay querying for a number of seconds, following any changes to your Wix events data.Only those with "Manage Events" permissions can query Wix events. Only the events they are authorized to receive are returned.