Introduction

When you execute a query with the find() function, it returns a Promise that resolves to a CreateRequestsQueryResult object. This object contains the items that match the query, information about the query itself, and functions for paging through the query results.

Did this help?

currentPage


currentPagenumberRead-only

Returns the index of the current results page number.

The currentPage is a zero-based index of the current page of results.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

The currentPage property returns undefined if the query returned no results.

JavaScript
let resultPage = results.currentPage; // 0
Did this help?

items


itemsArray<CreateRequest>Read-only

Returns the items that match the query.

The current page of create requests retrieved by the query.

Note: When no items match the query, the items array is empty.

To paginate your query results, use the CreateRequestsQueryResult pagination properties and functions.

Perform a query and get the returned items from the result
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { createRequests } from "wix-groups-backend"; export const getQueryResultItems = webMethod(Permissions.Anyone, async () => { try { const options = { suppressAuth: true, }; const results = await createRequests .queryCreateRequests() .limit(3) .find(options); if (results.items.length > 0) { return results.items; } else { console.log("No items found"); } } catch (error) { console.error(error); } }); /* items: * [ * { * "group":{ * "coverImage":{ * "imageUrl": "wix:image://v1/7fe8e9_153dc4be46974e348009011fa9f2d5a7~mv2.jpg/London.jpg#originWidth=3579&originHeight=2013", * "position": { * "x": 200, * "y": 350 * } * }, * "_createdDate":"2021-10-06T09:33:16.000Z", * "description":"Welcome to the group! You can connect with other members, get updates and share videos.", * "_id":"7e75dade-5f62-4eb4-b861-fa35b36d1f8d", * "lastActivityDate":"2021-10-06T09:33:16.000Z", * "memberCount":1, * "memberTitle":"Members", * "name":"GroupRequest1", * "owner":"937cd3db-e9be-4980-93c1-a6d767a11050", * "privacyStatus":"PUBLIC", * "settings":{ * "groupUpdatePostEnabled": true, * "membersCanApprove": false, * "membersCanInvite": true, * "showMemberList": true, * "welcomeMemberPostEnabled": true * }, * "slug":"grouprequest1", * "_updatedDate": "2021-10-06T09:33:18.000Z" * }, * "_id":"7e75dade-5f62-4eb4-b861-fa35b36d1f8d", * "rejectionReason":"undefined", * "status":"PENDING" * }, * { * "group":{ * "coverImage":{ * "imageUrl": "wix:image://v1/6974e348009011fa9f2d2961b~mv2.jpg/Houston.jpg#originWidth=3024&originHeight=4032", * "position": { * "x": 20, * "y": 35 * } * }, * "_createdDate":"2021-08-04T09:31:11.000Z", * "description":"Welcome to the group! You can connect with other members, get updates and share videos.", * "_id":"50ba513d-e7e4-4970-9c69-deb25b047436", * "lastActivityDate":2021-09-04T09:31:11.000Z", * "memberCount":1, * "memberTitle":"Friends", * "name":"GroupRequest2", * "owner":"937cd3db-e9be-4980-93c1-a6d767a11050", * "privacyStatus":"PUBLIC", * "settings":{ * "groupUpdatePostEnabled": true, * "membersCanApprove": false, * "membersCanInvite": true, * "showMemberList": true, * "welcomeMemberPostEnabled": true * }, * "slug":"grouprequest2", * "_updatedDate": "2021-09-04T09:31:11.000Z" * }, * "_id":"50ba513d-e7e4-4970-9c69-deb25b047436", * "rejectionReason":"undefined", * "status":"APPROVED" * }, * { * "group":{ * "coverImage":{ * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2d2961b~mv2.jpg/oak.jpg#originWidth=400&originHeight=900", * "position": { * "x": 30, * "y": 225 * } * }, * "_createdDate":"2021-04-12T09:24:16.000Z", * "description":"Welcome to the group! You can connect with other members, get updates and share videos.", * "_id":"7e75dade-5f62-4eb4-b861-fa35b36d1f8d", * "lastActivityDate":"2021-08-12T09:24:16.000Z", * "memberCount":1, * "memberTitle":"Colleagues", * "name":"GroupRequest3", * "owner":"937cd3db-e9be-4980-93c1-a6d767a11050", * "privacyStatus":"PUBLIC", * "settings":{ * "groupUpdatePostEnabled": true, * "membersCanApprove": false, * "membersCanInvite": true, * "showMemberList": true, * "welcomeMemberPostEnabled": true * }, * "slug":"grouprequest3", * "_updatedDate":"2021-08-12T09:24:16.000Z" * }, * "_id":"7e75dade-5f62-4eb4-b861-fa35b36d1f8d", * "rejectionReason":"undefined", * "status":"PENDING" * } * ] */
Did this help?

length


lengthnumberRead-only

Returns the number of items in the current results page.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

JavaScript
let resultLength = results.length; // 20
Did this help?