---
lang: en
title: 'API docs: filter.wherebuilder'
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.wherebuilder.html
---

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

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

## WhereBuilder class

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

**Signature:**

```typescript
export declare class WhereBuilder<MT extends object = AnyObject> 
```

## Example


```ts
const whereBuilder = new WhereBuilder();
const where = whereBuilder
  .eq('a', 1)
  .and({x: 'x'}, {y: {gt: 1}})
  .and({b: 'b'}, {c: {lt: 1}})
  .or({d: 'd'}, {e: {neq: 1}})
  .build();
```

## Constructors

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

Constructor


</th><th>

Modifiers


</th><th>

Description


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

[(constructor)(w)](./filter.wherebuilder._constructor_.md)


</td><td>


</td><td>

Constructs a new instance of the `WhereBuilder` class


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

## Properties

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

Property


</th><th>

Modifiers


</th><th>

Type


</th><th>

Description


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

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


</td><td>


</td><td>

[Where](./filter.where.md)<!-- -->&lt;MT&gt;


</td><td>


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

## Methods

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

Method


</th><th>

Modifiers


</th><th>

Description


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

[and(w)](./filter.wherebuilder.and.md)


</td><td>


</td><td>

Add an `and` clause.


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

[between(key, val1, val2)](./filter.wherebuilder.between.md)


</td><td>


</td><td>

Add a `between` condition


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

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


</td><td>


</td><td>

Get the where object


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

[cast(clause)](./filter.wherebuilder.cast.md)


</td><td>


</td><td>


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

[eq(key, val)](./filter.wherebuilder.eq.md)


</td><td>


</td><td>

Add an `=` condition


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

[exists(key, val)](./filter.wherebuilder.exists.md)


</td><td>


</td><td>

Add a `exists` condition


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

[gt(key, val)](./filter.wherebuilder.gt.md)


</td><td>


</td><td>

Add a `>` condition


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

[gte(key, val)](./filter.wherebuilder.gte.md)


</td><td>


</td><td>

Add a `>=` condition


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

[ilike(key, val)](./filter.wherebuilder.ilike.md)


</td><td>


</td><td>

Add a `ilike` condition


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

[impose(where)](./filter.wherebuilder.impose.md)


</td><td>


</td><td>

Add a where object. For conflicting keys with the existing where object, create an `and` clause.


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

[inq(key, val)](./filter.wherebuilder.inq.md)


</td><td>


</td><td>

Add a `inq` condition


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

[like(key, val)](./filter.wherebuilder.like.md)


</td><td>


</td><td>

Add a `like` condition


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

[lt(key, val)](./filter.wherebuilder.lt.md)


</td><td>


</td><td>

Add a `<` condition


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

[lte(key, val)](./filter.wherebuilder.lte.md)


</td><td>


</td><td>

Add a `<=` condition


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

[neq(key, val)](./filter.wherebuilder.neq.md)


</td><td>


</td><td>

Add a `!=` condition


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

[nilike(key, val)](./filter.wherebuilder.nilike.md)


</td><td>


</td><td>

Add a `nilike` condition


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

[nin(key, val)](./filter.wherebuilder.nin.md)


</td><td>


</td><td>

Add a `nin` condition


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

[nlike(key, val)](./filter.wherebuilder.nlike.md)


</td><td>


</td><td>

Add a `nlike` condition


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

[or(w)](./filter.wherebuilder.or.md)


</td><td>


</td><td>

Add an `or` clause.


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

[regexp(key, val)](./filter.wherebuilder.regexp.md)


</td><td>


</td><td>

Add a `regexp` condition


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

