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

# Exact Match Query

> Client language: Python. Also available for [C#](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/exact-match-query.md), [Java](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/exact-match-query.java.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."

> **Note**
>
> - By default, when querying strings the string comparisons are **case-insensitive**.
>
> - Use the `where_equals` method `exact` parameter to perform a search that is **case-sensitive**.
>
> - When making a dynamic query with an exact match, the auto-index created by the server indexes
>   the text of the document field using the [default exact analyzer](https://docs.ravendb.net/6.2/indexes/using-analyzers.python.md#using-the-default-exact-analyzer)
>   where the casing of the original text is unchanged.
>
> - In this page:
>   - [Query with exact match](#query-with-exact-match)
>   - [Query with exact match - nested object](#query-with-exact-match---nested-object)
>   - [Syntax](#syntax)

## Query with exact match

> **Note**
>
> ### Query
>
> ```python
> employees = list(
>   session.
>   # Make a query on 'Employees' collection
>   query(object_type=Employee)
>   # Query for all documents where 'FirstName' equals 'Robert'
>   # Pass 'exact=True' for a case-sensitive match
>   .where_equals("FirstName", "Robert", exact=True)
> )
> ```
>
> ### RQL
>
> ```sql
> from "Employees"
> where exact(FirstName == "Robert")
> ```

- Executing the above query will generate the auto-index `Auto/Employees/ByExact(FirstName)`.

- This auto-index will contain the following two index-fields:

  - `FirstName`  
    Contains terms with the text from the indexed document field 'FirstName'.  
    Text is lower-cased and not tokenized.

  - `exact(FirstName)`  
    Contain terms with the original text from the indexed document field 'FirstName'.  
    Casing is exactly the same as in the original text, and the text is not tokenized.  
    Making an exact query targets these terms to find matching documents.

## Query with exact match - nested object

> **Note**
>
> ### Query
>
> ```python
> orders = list(
>   session
>   # Make a query on 'Orders' collection
>   .query(object_type=Order)
>   # Query for documents that contain at least one order line with 'Teatime Chocolate Biscuits'
>   .where_equals(
>       "Lines[].ProductName",
>       "Teatime Chocolate Biscuits",
>       # Pass 'exact=True' for a case-sensitive match
>       exact=True,
>   )
> )
> ```
>
> ### RQL
>
> ```sql
> from "Orders" 
> where exact(Lines.ProductName == "Teatime Chocolate Biscuits")
> ```

## Syntax

```python
def where_equals(
  self, field_name: str, value_or_method: Union[object, MethodCall], exact: Optional[bool] = None
) -> DocumentQuery[_T]: ...
```

| Parameter | Type | Description |
| - | - | - |
| **field\_name** | `str` | Search-field name |
| **value\_or\_method** | `Union[object, MethodCall]` | `object` to match with <br />-or-<br />`MethodCall` with match condition |
| **exact** (optional) | `bool` | `False` - search is case-insensitive<br />`True` - search is case-sensitive |

| Return Type | Description |
| - | - |
| `DocumentQuery[_T]` | `where_equals` query results |

## See also

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