The GroupMembersQueryBuilder
functions enable you to run, sort, filter, and control
which results a query returns.
Typically, you build a query using the queryGroupMembers()
function,
refine the query by chaining GroupMembersQueryBuilder
functions, and then execute the
query by chaining the find()
function.
For example, the following code returns the first 5 group members with admin roles, and sorts them by the date they joined in ascending order.
import { members } from "wix-groups-backend";
members
.queryGroupMembers()
.eq("role", "ADMIN")
.ascending("joinedDate")
.limit(5)
.find()
.then((results) => {
console.log(results.items);
});