@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
75 lines (57 loc) • 3.32 kB
Markdown
---
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) > [@loopback/filter](./filter.md) > [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.
<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)](./filter.wherebuilder._constructor_.md) | | Constructs a new instance of the <code>WhereBuilder</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [where](./filter.wherebuilder.where.md) | | [Where](./filter.where.md)<!-- --><MT> | |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [and(w)](./filter.wherebuilder.and.md) | | Add an <code>and</code> clause. |
| [between(key, val1, val2)](./filter.wherebuilder.between.md) | | Add a <code>between</code> condition |
| [build()](./filter.wherebuilder.build.md) | | Get the where object |
| [cast(clause)](./filter.wherebuilder.cast.md) | | |
| [eq(key, val)](./filter.wherebuilder.eq.md) | | Add an <code>=</code> condition |
| [exists(key, val)](./filter.wherebuilder.exists.md) | | Add a <code>exists</code> condition |
| [gt(key, val)](./filter.wherebuilder.gt.md) | | Add a <code>></code> condition |
| [gte(key, val)](./filter.wherebuilder.gte.md) | | Add a <code>>=</code> condition |
| [ilike(key, val)](./filter.wherebuilder.ilike.md) | | Add a <code>ilike</code> condition |
| [impose(where)](./filter.wherebuilder.impose.md) | | Add a where object. For conflicting keys with the existing where object, create an <code>and</code> clause. |
| [inq(key, val)](./filter.wherebuilder.inq.md) | | Add a <code>inq</code> condition |
| [like(key, val)](./filter.wherebuilder.like.md) | | Add a <code>like</code> condition |
| [lt(key, val)](./filter.wherebuilder.lt.md) | | Add a <code><</code> condition |
| [lte(key, val)](./filter.wherebuilder.lte.md) | | Add a <code><=</code> condition |
| [neq(key, val)](./filter.wherebuilder.neq.md) | | Add a <code>!=</code> condition |
| [nilike(key, val)](./filter.wherebuilder.nilike.md) | | Add a <code>nilike</code> condition |
| [nin(key, val)](./filter.wherebuilder.nin.md) | | Add a <code>nin</code> condition |
| [nlike(key, val)](./filter.wherebuilder.nlike.md) | | Add a <code>nlike</code> condition |
| [or(w)](./filter.wherebuilder.or.md) | | Add an <code>or</code> clause. |
| [regexp(key, val)](./filter.wherebuilder.regexp.md) | | Add a <code>regexp</code> condition |