---
title: "Exact Match Query"
url: "https://docs.ravendb.net/6.2/client-api/session/querying/text-search/exact-match-query"
version: "6.2"
language: "java"
---

# Exact Match Query

> Client language: Java. Also available for [C#](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/exact-match-query.md), [Python](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/exact-match-query.python.md), [PHP](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/exact-match-query.php.md), [Node.js](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/exact-match-query.nodejs.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

By default, the `whereXXX` methods in `query` uses a case-insensitive match.

To perform a case-sensitive match you should use the `exact` parameter.

## Syntax

```java
IDocumentQuery<T> whereEquals(String fieldName, Object value, boolean exact);
IDocumentQuery<T> whereNotEquals(String fieldName, Object value, boolean exact);

// ... rest of where methods
```

| Parameters | | |
| - | - | - |
| **fieldName** | String | Object field to use |
| **value** | Object | Predicate value |
| **exact** | boolean | Indicates if `predicate` should be matched in case-sensitive manner |

## Example I - Query With Exact Match

### Java

```java
// load all entities from 'Employees' collection
// where firstName equals 'Robert' (case sensitive match)
List<Employee> employees = session.query(Employee.class)
  .whereEquals("FirstName", "Robert", true)
  .toList();
```

### RQL

```sql
from Employees where exact(FirstName == 'Robert')
```

## Example II - Query With Inner Exact Match

### Java

```java
// return all entities from 'Orders' collection
// which contain at least one order line with
// 'Singaporean Hokkien Fried Mee' product
// perform a case-sensitive match
List<Order> orders = session.query(Order.class)
  .whereEquals("Lines[].ProductName", "Singaporean Hokkien Fried Mee", true)
  .toList();
```

### RQL

```sql
from Orders 
where exact(Lines[].ProductName == 'Singaporean Hokkien Fried Mee')
```

## See also

- [Query overview](https://docs.ravendb.net/6.2/client-api/session/querying/how-to-query.md)
- [Full-text search](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/full-text-search.md)
- [How to Use Regex](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/using-regex.java.md)
- [Querying: Basics](https://docs.ravendb.net/6.2/indexes/querying/query-index.java.md)
