Creates a query to retrieve a list of staff members.
The queryStaffMembers()
function builds a query to retrieve a list of staff members and returns an StaffMembersQueryBuilder
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 StaffMembersQueryBuilder
functions onto the query. StaffMembersQueryBuilder
functions enable you to sort, filter, and control the results queryStaffMembers()
returns.
queryStaffMembers()
runs with these StaffMembersQueryBuilder
defaults, which you can override:
limit(50)
descending("_createdDate")
The functions that are chained to queryStaffMembers()
are applied in the order they're called. For example, if you apply ascending('createdDate') and then descending('id'), 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 ID.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
_id | eq() ,in() ,ne() ,ascending() ,descending() |
_createdDate | eq() ,ne() ,lt() ,le() ,gt() ,ge() ,in() ,exists() ,ascending() ,descending() |
_updatedDate | eq() ,ne() ,lt() ,le() ,gt() ,ge() ,in() ,exists() ,ascending() ,descending() |
function queryStaffMembers(
options: QueryStaffMembersOptions,
): StaffMembersQueryBuilder;
import { staffMembers } from "@wix/events";
async function queryStaffMembers() {
const { items } = await staffMembers.queryStaffMembers().find();
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.