---
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 markdown="1">

[FilterBuilder](./filter.filterbuilder.md)


</td><td markdown="1">

A builder for Filter. It provides fleunt APIs to add clauses such as `fields`<!-- -->, `order`<!-- -->, `where`<!-- -->, `limit`<!-- -->, `offset`<!-- -->, and `include`<!-- -->.


</td></tr>
<tr><td markdown="1">

[WhereBuilder](./filter.wherebuilder.md)


</td><td markdown="1">

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 markdown="1">

[filterTemplate(strings, keys)](./filter.filtertemplate.md)


</td><td markdown="1">


</td></tr>
<tr><td markdown="1">

[isFilter(candidate)](./filter.isfilter.md)


</td><td markdown="1">

TypeGuard for Filter


</td></tr>
</tbody></table>

## Interfaces

<table><thead><tr><th>

Interface


</th><th>

Description


</th></tr></thead>
<tbody><tr><td markdown="1">

[AndClause](./filter.andclause.md)


</td><td markdown="1">

And clause


</td></tr>
<tr><td markdown="1">

[Filter](./filter.filter.md)


</td><td markdown="1">

Query filter object


</td></tr>
<tr><td markdown="1">

[Inclusion](./filter.inclusion.md)


</td><td markdown="1">

Inclusion of related items

Note: scope means filter on related items

Example: `{relation: 'aRelationName', scope: {<AFilterObject>}}`


</td></tr>
<tr><td markdown="1">

[OrClause](./filter.orclause.md)


</td><td markdown="1">

Or clause


</td></tr>
</tbody></table>

## Type Aliases

<table><thead><tr><th>

Type Alias


</th><th>

Description


</th></tr></thead>
<tbody><tr><td markdown="1">

[Condition](./filter.condition.md)


</td><td markdown="1">

Condition clause


</td></tr>
<tr><td markdown="1">

[Direction](./filter.direction.md)


</td><td markdown="1">

Order by direction


</td></tr>
<tr><td markdown="1">

[Fields](./filter.fields.md)


</td><td markdown="1">

Selection of fields

Example: `{afieldname: true}`


</td></tr>
<tr><td markdown="1">

[FilterExcludingWhere](./filter.filterexcludingwhere.md)


</td><td markdown="1">

Filter without `where` property


</td></tr>
<tr><td markdown="1">

[InclusionFilter](./filter.inclusionfilter.md)


</td><td markdown="1">

Inclusion filter type e.g. 'property', {<!-- -->relation: 'property'<!-- -->}


</td></tr>
<tr><td markdown="1">

[KeyOf](./filter.keyof.md)


</td><td markdown="1">

Key types of a given model, excluding operators


</td></tr>
<tr><td markdown="1">

[Operators](./filter.operators.md)


</td><td markdown="1">

Operators for where clauses


</td></tr>
<tr><td markdown="1">

[Order](./filter.order.md)


</td><td markdown="1">

Order by

Example: `{afieldname: 'ASC'}`


</td></tr>
<tr><td markdown="1">

[PredicateComparison](./filter.predicatecomparison.md)


</td><td markdown="1">

Matching predicate comparison


</td></tr>
<tr><td markdown="1">

[ShortHandEqualType](./filter.shorthandequaltype.md)


</td><td markdown="1">

Value types for `{propertyName: value}`


</td></tr>
<tr><td markdown="1">

[Where](./filter.where.md)


</td><td markdown="1">

Where clause


</td></tr>
</tbody></table>


