---
lang: en
title: 'API docs: repository.wherebuilder'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/repository
permalink: /doc/en/lb4/apidocs.repository.wherebuilder.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [WhereBuilder](./repository.wherebuilder.md)

## WhereBuilder class

A builder for Where object. It provides fluent APIs to add clauses such as `and`<!-- -->, `or`<!-- -->, and other operators.

<b>Signature:</b>

```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

|  Constructor | Modifiers | Description |
|  --- | --- | --- |
|  [(constructor)(w)](./repository.wherebuilder._constructor_.md) |  | Constructs a new instance of the <code>WhereBuilder</code> class |

## Properties

|  Property | Modifiers | Type | Description |
|  --- | --- | --- | --- |
|  [where](./repository.wherebuilder.where.md) |  | <code>Where&lt;MT&gt;</code> |  |

## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  [and(w)](./repository.wherebuilder.and.md) |  | Add an <code>and</code> clause. |
|  [between(key, val1, val2)](./repository.wherebuilder.between.md) |  | Add a <code>between</code> condition |
|  [build()](./repository.wherebuilder.build.md) |  | Get the where object |
|  [cast(clause)](./repository.wherebuilder.cast.md) |  |  |
|  [eq(key, val)](./repository.wherebuilder.eq.md) |  | Add an <code>=</code> condition |
|  [exists(key, val)](./repository.wherebuilder.exists.md) |  | Add a <code>exists</code> condition |
|  [gt(key, val)](./repository.wherebuilder.gt.md) |  | Add a <code>&gt;</code> condition |
|  [gte(key, val)](./repository.wherebuilder.gte.md) |  | Add a <code>&gt;=</code> condition |
|  [impose(where)](./repository.wherebuilder.impose.md) |  | Add a where object. For conflicting keys with the existing where object, create an <code>and</code> clause. |
|  [inq(key, val)](./repository.wherebuilder.inq.md) |  | Add a <code>inq</code> condition |
|  [lt(key, val)](./repository.wherebuilder.lt.md) |  | Add a <code>&lt;</code> condition |
|  [lte(key, val)](./repository.wherebuilder.lte.md) |  | Add a <code>&lt;=</code> condition |
|  [neq(key, val)](./repository.wherebuilder.neq.md) |  | Add a <code>!=</code> condition |
|  [nin(key, val)](./repository.wherebuilder.nin.md) |  | Add a <code>nin</code> condition |
|  [or(w)](./repository.wherebuilder.or.md) |  | Add an <code>or</code> clause. |


