Introduction

When you execute a query with the find() function, it returns a Promise that resolves to a JoinRequestsQueryResult 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<JoinRequest>Read-only

Returns the items that match the query.

The current page of join requests retrieved by the query.

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

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

Perform a query and get the returned items from the result
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { joinRequests } from "wix-groups-backend"; /* Sample options value: * { * suppressAuth: true * } * Sample groupId value: * 'c5c8baa7-b3cd-457f-b4a7-6178327834c7' */ export const getQueryResultItems = webMethod(Permissions.Anyone, () => { return joinRequests .queryJoinRequests() .limit(3) .find({ groupId: groupId, options }) .then((results) => { if (results.items.length > 0) { return results.items; } else { console.log("No items found"); } }) .catch((error) => { console.error(error); }); }); /* items: * [ * { * "memberId": "7fe8e9e1-d050-4c86-9684-e7f231600a34" * "_createdDate": "Fri Oct 24 2021 22:45:50 GMT+0300" * "status": "PENDING" * }, * { * "memberId": "937cd3db-e9be-4980-93c1-a6d767a11050" * "_createdDate": "Wed May 14 2021 10:05:20 GMT+0300" * "status": "REJECTED" * "rejectionReason": "Wrong group" * }, * { * "memberId": "2CD58761-d050-4c86-9684-e7f2316229b3" * "_createdDate": "Sun July 11 2020 03:25:30 GMT+0300" * "status": "APPROVED" * } * ] */
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?

pageSize


pageSizenumberRead-only

Returns the query page size.

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 resultPageSize = results.pageSize; // 50
Did this help?

query


Returns the JoinRequestsQueryBuilder object used to get the current results.

Use the query property to create and run a new query by chaining additional JoinRequestsQueryBuilder functions to it.

JavaScript
let resultQuery = results.query;
Did this help?

totalCount


totalCountnumberRead-only

Returns the total number of items that match the query.

The totalCount returns the total number of items that match the query, not just the number of items in the current page.

JavaScript
let resultCount = results.totalCount; // 150
Did this help?

totalPages


totalPagesnumberRead-only

Returns the total number of pages the query produced.

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 resultPages = results.totalPages; // 3
Did this help?