---
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: "nodejs"
---

# Query vs DocumentQuery

> Client language: Node.js. 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), [Python](https://docs.ravendb.net/7.2/querying/document-query/query-vs-document-query.python.md), [PHP](https://docs.ravendb.net/7.2/querying/document-query/query-vs-document-query.php.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**
>
> - The **Node.js** client provides a **unified API** for querying documents via `session.query()` or `documentQuery()`.  
>   The `query` method is essentially a shorthand for invoking `documentQuery()`.
>
> - All available methods for the session *query* method are listed [here](https://docs.ravendb.net/7.2/querying/overview.nodejs.md#query-api).  
>   Examples of equivalent calls are listed below.
>
> - In this article:
>   - [Equivalent `query` & `documentQuery` calls](https://docs.ravendb.net/querying/document-query/query-vs-document-query#equivalent-query-documentquery-calls)

## Equivalent query & documentQuery calls {#equivalent-query-documentquery-calls}

```javascript
// This collection query:
session.query(Order);

// is equivalent to this documentQuery:    
session.advanced.documentQuery(Order);
```

```javascript
// This collection query:
session.query({ collection: "orders" });

// is equivalent to this documentQuery
session.advanced.documentQuery({
    collection: "orders",
    indexName: null,
    isMapReduce: false
});
```

```javascript
// This index query:
session.query({ indexName: "Orders/ByShipToAndLines" });

// is equivalent to this documentQuery:
session.advanced.documentQuery({ indexName: "Orders/ByShipToAndLines" });
```

```javascript
// This index query:
session.query({ indexName: "Orders/ByShipToAndLines" });

// is equivalent to this documentQuery:
session.advanced.documentQuery({
    indexName: "Orders/ByShipToAndLines",
    isMapReduce: false,
    collection: null
});
```

## See also

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