The GroupsQueryBuilder
functions enable you to run, sort, filter, and control
which results a query returns.
Typically, you build a query using the queryGroups()
function,
refine the query by chaining GroupsQueryBuilder
functions, and then execute the
query by chaining the find()
function.
For example, the following code returns the first 5 groups with the name 'Parents', and sorts them by created date in ascending order.
import { groups } from "wix-groups-backend";
groups
.queryGroups()
.eq("name", "Parents")
.ascending("_createdDate")
.limit(5)
.find()
.then((results) => {
console.log(results.items);
});