# Pagination/Sort issues with @cascade on 21.03.1

**URL:** <https://discuss.dgraph.io/t/pagination-sort-issues-with-cascade-on-21-03-1/15947>\
**Category:** Dgraph\
**Tags:** kind:bug\
**Created:** [November 2, 2021, 6:35am UTC](https://discuss.dgraph.io/t/pagination-sort-issues-with-cascade-on-21-03-1/15947 "2021-11-02T06:35:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Pedini](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/alex_pedini/32/9060_2.png) [@Alex\_Pedini](https://discuss.dgraph.io/u/Alex_Pedini)\
**Post date:** [November 2, 2021, 6:35am UTC](https://discuss.dgraph.io/t/pagination-sort-issues-with-cascade-on-21-03-1/15947/1 "2021-11-02T06:35:46Z")

</div>

* * *

## Report a Dgraph Bug

### What version of Dgraph are you using?

> **Dgraph Version**
>
> ```auto
> $ dgraph version
>  
> Dgraph version : v21.03.1
> Dgraph codename : rocket-1
> Dgraph SHA-256 : a00b73d583a720aa787171e43b4cb4dbbf75b38e522f66c9943ab2f0263007fe
> Commit SHA-1 : ea1cb5f35
> Commit timestamp : 2021-06-17 20:38:11 +0530
> Branch : HEAD
> Go version : go1.16.2
> jemalloc enabled : true
> 
> ```

### Have you tried reproducing the issue with the latest release?

Yes, I’m running `dgraph/standalone:latest`

### What is the hardware spec (RAM, OS)?

Macbook Pro Core i9  
32GB ram, 12 allocated to Docker Desktop

### Steps to reproduce the issue (command/config used to run Dgraph).

Newbie here 😅 so I’m following the tour, I loaded into my local dgraph the data set at this step:

> **[Quickstart - Dgraph](https://docs.hypermode.com/dgraph/quickstart)**

I’m running Dgraph with:

```auto
docker run -it -p 5080:5080 -p 6080:6080 -p 8080:8080 \
  -p 9080:9080 -p 8000:8000 -v ~/dgraph:/dgraph --name dgraph \
  dgraph/standalone:latest

```

### Expected behaviour and actual result.

I was playing with queries before moving to the next step in the tutorial, and I noticed a strange behaviour when using @cascade together with pagination/sorting.

More specifically I’m running this:

```auto
{
  tom_hanks_movies(func: type(Movie), first: 5) @cascade {
    name@.
    initial_release_date
    ~director.film {
        name@.
    }
    starring {
        performance.character {
            name@.
        }
        performance.actor @filter(eq(name@., "Tom Hanks")) {
            name@.
        }
    }
  }
}

```

and it returns correctly 5 results, but if I do:

```auto
{
  tom_hanks_movies(func: type(Movie), first: 5, orderasc: name@.) @cascade {
    name@.
    initial_release_date
    ~director.film {
        name@.
    }
    starring {
        performance.character {
            name@.
        }
        performance.actor @filter(eq(name@., "Tom Hanks")) {
            name@.
        }
    }
  }
}

```

It returns 0 results, btw also if I order by initial\_release\_date it returns 0 results.  
Then I noticed this:

```auto
{
  tom_hanks_movies(func: type(Movie), first: 5) {
    count(uid)
  }
}
=>
{
"data": {
        "tom_hanks_movies": [
            {
                "count": 5
            }
        ]
    }
}

```

```auto
{
  tom_hanks_movies(func: type(Movie), first: 5, orderasc: name@.) @cascade {
    count(uid)
  }
}
=>
{
"data": {
        "tom_hanks_movies": [
            {
                "count": 5
            }
        ]
    }
}

```

```auto
{
  tom_hanks_movies(func: type(Movie), first: 5) @cascade {
    count(uid)
  }
}
=>
{
"data": {
        "tom_hanks_movies": [
            {
                "count": 125614
            }
        ]
    }
}

```

```auto
{
  tom_hanks_movies(func: type(Movie), first: 5, orderasc: name@en) @cascade {
    count(uid)
  }
}
=>
{
"data": {
        "tom_hanks_movies": [
            {
                "count": 1000
            }
        ]
    }
}

```

I understand that ordering on a count() and @cascade without filters don’t really make sense, but I would still expect the same count of 5 given the `first: 5`, no? 🧐

Just as a side note, if I run the same query with orderasc and cascade on version 21.03.0, the `dgraph alpha` process panics and exits… this was fixed in 21.03.1

* * *
