Creates a query to retrieve a list of discount rules.
The queryDiscountRules() function builds a query to retrieve a list of up to 100 discount rules, and returns a DiscountRulesQueryBuilder 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 DiscountRulesQueryBuilder functions onto the query. DiscountRulesQueryBuilder functions enable you to sort, filter, and control the results queryDiscountRules() returns.
By default, queryDiscountRules() sorts results by ascending("_id") by default. This can be overridden.
To learn how to query posts, refer to the table below.
The following DiscountRulesQueryBuilder functions are supported for the queryDiscountRules() function. For a full description of the discount rule object, see the object returned for the items property in the DiscountRulesQueryResult.
| PROPERTY | SUPPORTED FILTERS & SORTING |
|---|---|
_id | eq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending() |
revision | eq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge(),ascending(),descending() |
_createdDate | eq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge(),ascending(),descending() |
_updatedDate | eq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge(),ascending(),descending() |
active | eq(),ne(),exists(),in(),hasSome(),ascending(),descending() |
name | eq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending() |
activeTimeInfo.start | eq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge(),ascending(),descending() |
activeTimeInfo.end | eq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge(),ascending(),descending() |
This function requires elevated permissions and runs only on the backend and on dashboard pages.
This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.