# Sorting on datetime field with @ cascade, creates panic

**URL:** <https://discuss.dgraph.io/t/sorting-on-datetime-field-with-cascade-creates-panic/14297>\
**Category:** GraphQL\
**Tags:** status:accepted, kind:bug, ticket:created\
**Created:** [May 24, 2021, 1:39pm UTC](https://discuss.dgraph.io/t/sorting-on-datetime-field-with-cascade-creates-panic/14297 "2021-05-24T13:39:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeerajMittal](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/neerajmittal/32/8274_2.png) [@NeerajMittal](https://discuss.dgraph.io/u/NeerajMittal)\
**Post date:** [May 24, 2021, 1:39pm UTC](https://discuss.dgraph.io/t/sorting-on-datetime-field-with-cascade-creates-panic/14297/1 "2021-05-24T13:39:01Z")

</div>

## Report a Dgraph Bug

### What version of Dgraph are you using?

> **Dgraph Version**
>
> v21.03.0

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

Its the latest version

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

Running docker container with tag v21.03-slash

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

Note: added space after @ as it was giving error can’t add more than two users

```auto
type Segment {
    id: ID!
    code: String! @ id
    description: String
}
type Catalog {
    id: ID!
    code: String! @ id
    description: String
    segment: [Segment!] 
    releaseDate: DateTime @ search(by: [day])
}

queryCatalog(filter: {releaseDate : {le: "2021-05-01"}}, order: {desc: releaseDate}, first:1) @ cascade(fields = ["segment"]) {
    .code
     segment {
        code
     }
  }
}

```

### Expected behaviour and actual result.

Note: Had to remove some lines from stack as you don’t allow more than 2 links

I0524 13:31:58.893450 17 http.go:240] namespace: 0. Got GraphQL request over HTTP.  
2021/05/24 13:31:58 1 0

```
/ext-go/1/src/github.com/dgraph-io/dgraph/x/error.go:107
/ext-go/1/src/github.com/dgraph-io/dgraph/worker/sort.go:694
/ext-go/1/src/github.com/dgraph-io/dgraph/worker/sort.go:286
/ext-go/1/src/github.com/dgraph-io/dgraph/worker/sort.go:518

```

runtime.goexit  
/usr/local/go/src/runtime/asm\_amd64.s:1371

* * *

---

<div class="post-metadata">

**Author:** ![amaster507](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/amaster507/32/4123_2.png) [@amaster507](https://discuss.dgraph.io/u/amaster507)\
**Post date:** [May 24, 2021, 7:40pm UTC](https://discuss.dgraph.io/t/sorting-on-datetime-field-with-cascade-creates-panic/14297/2 "2021-05-24T19:40:06Z")

</div>

```auto
query {
  queryCatalog(filter: {releaseDate : {le: “2021-05-01”}}, order: {desc: releaseDate}, first:1) @cascade(fields: [“segment”]) {
    code
    segment {
      code
    }
  }
}

```

Try this ^. You had a few pieces of syntax incorrect if they were not just copy/paste errors.

---

<div class="post-metadata">

**Author:** ![NeerajMittal](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/neerajmittal/32/8274_2.png) [@NeerajMittal](https://discuss.dgraph.io/u/NeerajMittal)\
**Post date:** [May 25, 2021, 3:12am UTC](https://discuss.dgraph.io/t/sorting-on-datetime-field-with-cascade-creates-panic/14297/3 "2021-05-25T03:12:22Z")

</div>

Yes, that was typing mistake.

if i sort on code, no issues, just sorting on date breaks the server.

---

<div class="post-metadata">

**Author:** ![chewxy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/chewxy/32/4339_2.png) [@chewxy](https://discuss.dgraph.io/u/chewxy)\
**Post date:** [May 26, 2021, 12:51am UTC](https://discuss.dgraph.io/t/sorting-on-datetime-field-with-cascade-creates-panic/14297/4 "2021-05-26T00:51:21Z")

</div>

I have validated that this is a bug in the latest version. Accepting as issue. @hardik to prioritize
