---
title: "Query vs DocumentQuery"
description: "Compare RavenDB Query and DocumentQuery APIs to choose the right approach for your querying needs, with syntax examples."
url: "https://docs.ravendb.net/7.2/querying/document-query/query-vs-document-query"
version: "7.2"
language: "python"
---

# Query vs DocumentQuery

> Client language: Python. Also available for [C#](https://docs.ravendb.net/7.2/querying/document-query/query-vs-document-query.md), [Java](https://docs.ravendb.net/7.2/querying/document-query/query-vs-document-query.java.md), [PHP](https://docs.ravendb.net/7.2/querying/document-query/query-vs-document-query.php.md), [Node.js](https://docs.ravendb.net/7.2/querying/document-query/query-vs-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 `rawQuery`.  
>   Learn more in [Query Overview](https://docs.ravendb.net/7.2/querying/overview.python.md).
>
> - In the **Python** client API, `query` and `document_query` provide **identical functionality**.
>   This is different from the **C#** client implementation, where `Query` supports LINQ while `DocumentQuery` provides lower-level flexibility and control.
>
> - All available methods for the session `query` and `document_query` methods are listed [here](https://docs.ravendb.net/7.2/querying/overview.python.md#query-api).  
>   Examples of equivalent calls are listed below.
>
> - In this article:
>   - [Examples of equivalent `query` & `document_query` calls](#examples-of-equivalent-query-document_query-calls)

## Examples of equivalent query & document\_query calls {#examples-of-equivalent-query-document\_query-calls}

```python
# This collection query:
session.query(object_type=Order)

# is equivalent to this document_query:    
session.advanced.document_query(object_type=Order)
```

```python
# This collection query:
session.query_collection("orders")

# is equivalent to this document_query
session.advanced.document_query(
    collection_name="orders",
    index_name=None,
    is_map_reduce=False
)
```

```python
# This index query:
session.query_index(index_name="Orders/ByShipToAndLines")

# is equivalent to this document_query:
session.advanced.document_query(index_name="Orders/ByShipToAndLines")
```

```python
# This index query:
session.query_index(index_name="Orders/ByShipToAndLines")

# is equivalent to this document_query:
session.advanced.document_query(
    index_name="Orders/ByShipToAndLines", 
    is_map_reduce=False,
    collection_name=None
)
```

## See also

- [Query Overview](https://docs.ravendb.net/7.2/querying/overview.python.md)
- [What is a Document Query](https://docs.ravendb.net/7.2/querying/document-query/what-is-document-query.python.md)
- [Filter with Lucene Syntax](https://docs.ravendb.net/7.2/querying/filtering-query-results/filter-with-lucene-syntax.python.md)
- [Querying an Index](https://docs.ravendb.net/7.2/indexes/querying/query-index.python.md)
