Search.../

Introduction

The LabelsQueryBuilder allows you to run, sort, and control which results a query returns.

Typically, you build a query using the queryLabels() function, refine the query by chaining LabelsQueryBuilder functions, and then execute the query by chaining the find() function.

For example, the following code returns the first 5 labels that were created by sorting them in ascending order:

import { contacts } from 'wix-crm-backend';
contacts.queryLabels()
.ascending("_createdDate")
.limit(5)
.find()
.then( (results) => {
return results.items;
});
javascript | Copy Code

Note: Only visitors with Manage Contacts permissions can query labels. You can override the permissions by setting the suppressAuth option to true in the find() function.

Was this helpful?