> For the complete documentation index, see [llms.txt](https://ronaldaug.gitbook.io/sim-rest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ronaldaug.gitbook.io/sim-rest/sort-and-limit.md).

# Filter data

**Note**: These below filter parameters only work with **DB::where("collection-name")->all()** function.

## Sort

Sort by **DESC** is default

You can sort by **ASC** from url as below

```
example.com/posts?sort=ASC
```

## Limit

Limit by **0 index** is default

You can limit collection from url as below

```
example.com/posts?limit=4
```

## Only

`only` can retrieve the data with specific keys.&#x20;

```
example.com/posts?only=title,author,category
```

## Query examples

```
example.com/posts?limit=2
```

```
example.com/posts?sort=DESC
```

```
example.com/posts?limit=4&sort=ASC&only=title
```

```
example.com/posts?limit=10&sort=DESC&only=username,email
```
