---
lang: en
title: 'API docs: filter'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/filter
permalink: /doc/en/lb4/apidocs.filter.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/filter](./filter.md)

## filter package

A set of utility typings and filter builders to aid in constructing LoopBack filters using the [builder pattern](https://en.wikipedia.org/wiki/Builder_pattern)<!-- -->.

## Remarks

This lightweight module provides strongly-typed typings and filter builders to intuitively construct LoopBack filters to be used against querying a LoopBack filter-compatible server over the network or within the server itself.

## Classes

<table><thead><tr><th>

Class


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[FilterBuilder](./filter.filterbuilder.md)


</td><td>

A builder for Filter. It provides fleunt APIs to add clauses such as `fields`<!-- -->, `order`<!-- -->, `where`<!-- -->, `limit`<!-- -->, `offset`<!-- -->, and `include`<!-- -->.


</td></tr>
<tr><td>

[WhereBuilder](./filter.wherebuilder.md)


</td><td>

A builder for Where object. It provides fluent APIs to add clauses such as `and`<!-- -->, `or`<!-- -->, and other operators.


</td></tr>
</tbody></table>

## Functions

<table><thead><tr><th>

Function


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[filterTemplate(strings, keys)](./filter.filtertemplate.md)


</td><td>


</td></tr>
<tr><td>

[isFilter(candidate)](./filter.isfilter.md)


</td><td>

TypeGuard for Filter


</td></tr>
</tbody></table>

## Interfaces

<table><thead><tr><th>

Interface


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[AndClause](./filter.andclause.md)


</td><td>

And clause


</td></tr>
<tr><td>

[Filter](./filter.filter.md)


</td><td>

Query filter object


</td></tr>
<tr><td>

[Inclusion](./filter.inclusion.md)


</td><td>

Inclusion of related items

Note: scope means filter on related items

Example: `{relation: 'aRelationName', scope: {<AFilterObject>}}`


</td></tr>
<tr><td>

[OrClause](./filter.orclause.md)


</td><td>

Or clause


</td></tr>
</tbody></table>

## Type Aliases

<table><thead><tr><th>

Type Alias


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[Condition](./filter.condition.md)


</td><td>

Condition clause


</td></tr>
<tr><td>

[Direction](./filter.direction.md)


</td><td>

Order by direction


</td></tr>
<tr><td>

[Fields](./filter.fields.md)


</td><td>

Selection of fields

Example: `{afieldname: true}`


</td></tr>
<tr><td>

[FilterExcludingWhere](./filter.filterexcludingwhere.md)


</td><td>

Filter without `where` property


</td></tr>
<tr><td>

[InclusionFilter](./filter.inclusionfilter.md)


</td><td>

Inclusion filter type e.g. 'property', {<!-- -->relation: 'property'<!-- -->}


</td></tr>
<tr><td>

[KeyOf](./filter.keyof.md)


</td><td>

Key types of a given model, excluding operators


</td></tr>
<tr><td>

[Operators](./filter.operators.md)


</td><td>

Operators for where clauses


</td></tr>
<tr><td>

[Order](./filter.order.md)


</td><td>

Order by

Example: `{afieldname: 'ASC'}`


</td></tr>
<tr><td>

[PredicateComparison](./filter.predicatecomparison.md)


</td><td>

Matching predicate comparison


</td></tr>
<tr><td>

[ShortHandEqualType](./filter.shorthandequaltype.md)


</td><td>

Value types for `{propertyName: value}`


</td></tr>
<tr><td>

[Where](./filter.where.md)


</td><td>

Where clause


</td></tr>
</tbody></table>

