Having problems with ordering by numeric value

94 views Asked by At

I have JSON data in my collection similar to following example. There is a icCount property with numeric value. Now when I issue a query with order specified by icCount, its sorted as text and not numeric value (see screenshot below). Index is automatic here. Any idea what is wrong here? (running RavenDB 4.1.1)

{
    "enabled": true,
    "description": "",
    "icCount": 3865,
    "companyname": "ABC Data"
}

enter image description here

1

There are 1 answers

0
David Marko On

Ok, so I just found it myself. Help here https://ravendb.net/docs/article-page/4.1/csharp/indexes/querying/sorting states that I should specify ordering mode(type). For my case I can simply rewrite it to: order by icCount as long desc ... see the long in clause. This way my data list is ordered correctly.