---
title: "What is a DocumentQuery?"
description: "Use DocumentQuery in RavenDB for a lower-level, chainable query API that provides more control than the standard LINQ-based Query."
url: "https://docs.ravendb.net/7.2/querying/document-query/what-is-document-query"
version: "7.2"
language: "python"
---

# What is a DocumentQuery?

> Client language: Python. Also available for [C#](https://docs.ravendb.net/7.2/querying/document-query/what-is-document-query.md), [Java](https://docs.ravendb.net/7.2/querying/document-query/what-is-document-query.java.md), [PHP](https://docs.ravendb.net/7.2/querying/document-query/what-is-document-query.php.md), [Node.js](https://docs.ravendb.net/7.2/querying/document-query/what-is-document-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**
>
> - RavenDB Queries can be executed using `query` or `document_query`,  
>   or by passing raw [RQL](https://docs.ravendb.net/7.2/querying/rql/what-is-rql.md) directly to the server via `raw_query`.  
>   Learn more in [Query Overview](https://docs.ravendb.net/7.2/querying/overview.python.md).
>
> - Unlike the **C#** client (where the `Query` method supports LINQ while `DocumentQuery` provides lower-level flexibility and control),
>   the **Python** client API implements the `query` and `document_query` methods with **identical functionality**.
>
>   Therefore, our Python documentation typically provides `query` samples without duplicating them for `document_query`.  
>   See [query -vs- document\_query](https://docs.ravendb.net/7.2/querying/document-query/query-vs-document-query.python.md) for additional details.
>
> - In this article:
>   - [`document_query` examples](#document_query-examples)
>   - [Syntax](#syntax)

## document\_query examples {#document\_query-examples}

#### Query collection - no filtering

##### document\_query

```python
all_employees = list(session.advanced.document_query(object_type=Employee))
```

##### RQL

```sql
from "Employees"
```

#### Query collection - by ID

##### document\_query

```python
# Query collection by document ID
employee = (
    session.advanced.document_query(object_type=Employee)
    .where_equals("Id", "employees/1-A")
    .first()
)
```

##### RQL

```sql
from "Employees" where id() == "employees/1-A"
```

#### Query collection - with filtering

##### document\_query

```python
# Query collection - filter by document field
employees = list(
    session.advanced.document_query(object_type=Employee).where_equals("first_name", "Robert")
)
```

##### RQL

```sql
from "Employees" where FirstName == "Robert"
```

#### Query collection - with paging

##### document\_query

```python
# Query collection - page results
products = list(session.advanced.document_query(object_type=Product).skip(5).take(10))
```

##### RQL

```sql
from "Products" limit 5, 10 // skip 5, take 10
```

#### Query an index

Refer to [Querying an index](https://docs.ravendb.net/7.2/indexes/querying/query-index.python.md#sessionadvanceddocumentquery) for examples of querying an index using `document_query`.

## Syntax {#syntax}

The definition for `document_query` is listed in the [Syntax section](https://docs.ravendb.net/7.2/querying/overview.python.md#syntax) of the [Query Overview](https://docs.ravendb.net/7.2/querying/overview.python.md).

## See also

- [Query overview](https://docs.ravendb.net/7.2/querying/overview.python.md)
- [Filter with Lucene Syntax](https://docs.ravendb.net/7.2/querying/filtering-query-results/filter-with-lucene-syntax.python.md)
- [Querying: Basics](https://docs.ravendb.net/7.2/indexes/querying/query-index.python.md)
- [Query vs DocumentQuery](https://docs.ravendb.net/7.2/querying/document-query/query-vs-document-query.python.md)
- [Projections](https://docs.ravendb.net/7.2/indexes/querying/projections.python.md)
