queryGuests( )
Creates a query to retrieve a list of guests.
Description
The queryGuests()
function builds a query to retrieve a list of guests and returns a GuestsQueryBuilder 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 GuestsQueryBuilder
functions onto the query. GuestsQueryBuilder
functions enable you to sort, filter, and control the results that queryGuests.find()
returns.
The query runs with the following GuestsQueryBuilder
defaults that you can override:
The functions that are chained to queryGuests()
are applied in the order they are called. For example, if you apply ascending ('_createdDate')
and then descending ('_updatedDate')
, the results are sorted first by the created date and then, if there are multiple results with the same date, the items are sorted by the updated date.
The table below shows which GuestsQueryBuilder
functions are supported for queryGuests()
. You can only use one filter function for each property. Only the first filter will work if a property is used in more than one filter.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
id | eq() ,ne() ,in() ,exists() |
eventId | eq() ,ne() ,in() ,exists() |
rsvpId | eq() ,ne() ,in() ,exists() |
orderNumber | eq() ,ne() ,in() ,exists() |
ticketNumber | eq() ,ne() ,in() ,exists() |
tickets | exists() |
contactId | eq() ,ne() ,in() ,exists() |
guestDetails.checkedIn | eq() ,ne() ,exists() |
attendanceStatus | eq() ,ne() ,in() ,exists() |
secondaryLanguageCode | eq() ,ne() ,in() ,exists() |
createdDate | eq() ,ne() ,lt() ,le() ,gt() ,in() ,exists() ,ascending() ,descending() |
updatedDate | eq() ,ne() ,lt() ,le() ,gt() ,in() ,exists() ,ascending() ,descending() |
attendanceStatusUpdatedDate | eq() ,ne() ,lt() ,le() ,gt() ,in() ,exists() ,ascending() ,descending() |
memberId | eq() ,ne() ,in() ,exists() |
guestType | eq() ,ne() ,in() ,exists() |
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function queryGuests(): GuestsQueryBuilder
queryGuests Parameters
This function does not take any parameters.
Returns
Return Type:
Was this helpful?
1import { guests } from "wix-events.v2";23async function queryGuests() {4 try {5 const result = await guests.queryGuests()6 .eq("guestType", "RSVP")7 .ascending("_createdDate")8 .find()9 return result;10 } catch (error) {11 console.error(error);12 // Handle the error13 }14 }1516/* RSVP guests info17{18 [19 {20 "_id": "be050b90-5915-4888-83eb-f39bb4ff4b94",21 "eventId": "b189cf8b-a61f-443b-95bb-d9e88af0a277",22 "rsvpId": "c83047ff-fae6-420b-a1d6-5ad2be59cb96",23 "tickets": [],24 "contactId": "023b6403-17e6-42dc-b475-a5ae6c2b8df4",25 "attendanceStatus": "ATTENDING",26 "_createdDate": "2023-01-27T12:35:46.749Z",27 "_updatedDate": "2023-01-27T12:35:46.749Z",28 "attendanceStatusUpdatedDate": "2023-01-27T12:35:46.000Z",29 "guestType": "RSVP"30 },31 {32 "_id": "2caffa73-6c17-4797-b2df-5a7fc78b21d7",33 "eventId": "b189cf8b-a61f-443b-95bb-d9e88af0a277",34 "rsvpId": "1480c6f1-a425-4e05-89c0-44e5d27136cd",35 "tickets": [],36 "contactId": "804e6beb-365f-4992-8e35-8f12788e62fa",37 "attendanceStatus": "ATTENDING",38 "_createdDate": "2023-01-27T12:54:26.558Z",39 "_updatedDate": "2023-01-27T12:54:26.558Z",40 "attendanceStatusUpdatedDate": "2023-01-27T12:54:26.000Z",41 "guestType": "RSVP"42 }43]44} */
1import { guests } from "wix-events.v2";23async function queryGuests() {4 try {5 const result = await guests.queryGuests()6 .eq("guestType", "BUYER")7 .eq("eventId", "9d720f99-1b5a-4141-9877-d32985391e18")8 .find();9 return result;10 } catch (error) {11 console.error(error);12 // Handle the error13 }14 }15/*Returns all found buyers16{17 "_items": [18 {19 "_id": "708aaa09-c34a-431b-919f-6db7dadde381",20 "eventId": "9d720f99-1b5a-4141-9877-d32985391e18",21 "orderNumber": "2T90-H5P6-17J",22 "tickets": [23 {24 "number": "2T90-H5P6-17J1P",25 "definitionId": "13fba1ae-657f-47d0-8759-fd8df5a94e65",26 "name": "Participant ticket"27 },28 {29 "number": "2T90-H5P6-17J1Q",30 "definitionId": "13fba1ae-657f-47d0-8759-fd8df5a94e65",31 "name": "Participant ticket"32 }33 ],34 "contactId": "023b6403-17e6-42dc-b475-a5ae6c2b8df4",35 "attendanceStatus": "ATTENDING",36 "_createdDate": "2023-03-16T12:49:34.103Z",37 "_updatedDate": "2023-03-16T12:49:34.119Z",38 "attendanceStatusUpdatedDate": "2023-03-16T12:49:34.006Z",39 "guestType": "BUYER"40 }41 ],42 "_originQuery": {43 "filterTree": {44 "$and": [45 {46 "guestType": "BUYER"47 },48 {49 "eventId": "9d720f99-1b5a-4141-9877-d32985391e18"50 }51 ]52 },53 "invalidArguments": [],54 "encoder": {},55 "transformationPaths": {},56 "sort": [],57 "paging": {},58 "pagingMethod": "CURSOR",59 "builderOptions": {60 "cursorWithEmptyFilterAndSort": true61 }62 },63 "_limit": 50,64 "_nextCursor": "",65 "_prevCursor": "",66 "cursors": {67 "next": "",68 "prev": ""69 }70}71*/
1import { guests } from "wix-events.v2";23async function queryGuests() {4 try {5 const result = await guests.queryGuests()6 .eq("guestType", "TICKET_HOLDER")7 .find()8 return result;9 } catch (error) {10 console.error(error);11 // Handle the error12 }13 }1415/*Returns all found ticket holders16{17 "_items": [18 {19 "_id": "072f5b64-9c2b-4ab7-bd43-6cc929387edf",20 "eventId": "39d16ecc-0ec8-4764-8077-8e991f20ef9d",21 "orderNumber": "2T8L-QWFK-93K",22 "ticketNumber": "2T8L-QWFK-93K1Q",23 "tickets": [],24 "contactId": "804e6beb-365f-4992-8e35-8f12788e62fa",25 "attendanceStatus": "ATTENDING",26 "_createdDate": "2023-03-13T13:29:25.462Z",27 "_updatedDate": "2023-03-13T13:29:25.514Z",28 "attendanceStatusUpdatedDate": "2023-03-13T13:29:25.416Z",29 "guestType": "TICKET_HOLDER"30 },31 {32 "_id": "1a446e7a-0525-4747-87d5-e1f153e2a041",33 "eventId": "9d720f99-1b5a-4141-9877-d32985391e18",34 "orderNumber": "2T90-H5P6-17J",35 "ticketNumber": "2T90-H5P6-17J1P",36 "tickets": [37 {38 "number": "2T90-H5P6-17J1P",39 "definitionId": "13fba1ae-657f-47d0-8759-fd8df5a94e65",40 "name": "Participant ticket"41 }42 ],43 "contactId": "023b6403-17e6-42dc-b475-a5ae6c2b8df4",44 "attendanceStatus": "ATTENDING",45 "_createdDate": "2023-03-16T12:49:34.103Z",46 "_updatedDate": "2023-03-16T12:49:34.119Z",47 "attendanceStatusUpdatedDate": "2023-03-16T12:49:34.006Z",48 "guestType": "TICKET_HOLDER"49 },50 {51 "_id": "5f6deb9b-2e5a-4c2c-9f9b-5b0b08a0b425",52 "eventId": "9d720f99-1b5a-4141-9877-d32985391e18",53 "orderNumber": "2T90-H5P6-17J",54 "ticketNumber": "2T90-H5P6-17J1Q",55 "tickets": [56 {57 "number": "2T90-H5P6-17J1Q",58 "definitionId": "13fba1ae-657f-47d0-8759-fd8df5a94e65",59 "name": "Participant ticket"60 }61 ],62 "contactId": "804e6beb-365f-4992-8e35-8f12788e62fa",63 "attendanceStatus": "ATTENDING",64 "_createdDate": "2023-03-16T12:49:34.103Z",65 "_updatedDate": "2023-03-16T12:49:34.119Z",66 "attendanceStatusUpdatedDate": "2023-03-16T12:49:34.006Z",67 "guestType": "TICKET_HOLDER"68 },69 {70 "_id": "fad83646-a312-4115-9b04-7ba3e98a8e49",71 "eventId": "39d16ecc-0ec8-4764-8077-8e991f20ef9d",72 "orderNumber": "2T8L-QWFK-93K",73 "ticketNumber": "2T8L-QWFK-93K1P",74 "tickets": [],75 "contactId": "023b6403-17e6-42dc-b475-a5ae6c2b8df4",76 "attendanceStatus": "ATTENDING",77 "_createdDate": "2023-03-13T13:29:25.462Z",78 "_updatedDate": "2023-03-13T13:29:25.514Z",79 "attendanceStatusUpdatedDate": "2023-03-13T13:29:25.416Z",80 "guestType": "TICKET_HOLDER"81 }82 ],83 "_originQuery": {84 "filterTree": {85 "$and": [86 {87 "guestType": "TICKET_HOLDER"88 }89 ]90 },91 "invalidArguments": [],92 "encoder": {},93 "transformationPaths": {},94 "sort": [],95 "paging": {},96 "pagingMethod": "CURSOR",97 "builderOptions": {98 "cursorWithEmptyFilterAndSort": true99 }100 },101 "_limit": 50,102 "_nextCursor": "",103 "_prevCursor": "",104 "cursors": {105 "next": "",106 "prev": ""107 }108}109*/