---
url: /nestjs-odata/api/generated/functions/parseQuery.md
---
# Function: parseQuery()

> **parseQuery**(`queryString`): [`QueryOptions`](../interfaces/QueryOptions.md)

Defined in: [parser/parser.ts:706](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/parser/parser.ts#L706)

Parse an OData query string into a QueryOptions object.
Handles $filter, $orderby, $select, $top, $skip and $expand; unknown query options (and
$count, $search, $apply) are silently ignored, and the last of repeated options wins.

The string is split on `&` and the values are used as given, without percent-decoding, so a
value cannot hold `&`. For a percent-encoded query string use [parseQueryString](parseQueryString.md), and for
decoded values by name (`req.query`) use [parseQueryOptions](parseQueryOptions.md).

## Parameters

### queryString

`string`

Query string, with or without leading '?'

## Returns

[`QueryOptions`](../interfaces/QueryOptions.md)

Parsed QueryOptions (fields are optional — only present when found in query)

## Throws

ODataParseError on syntax errors
