Search code examples
ravendbravendb-studio

Is it possible to order results when querying in the RavenDB studio?


Sometimes, I'm just looking at data in the RavenDB studio, usually by index, and I wanted to know if there was a way to specify a sort option?

For example, if I have simple index like this:

from doc in docs.Pages
select new
{
    Query = new[] { page.Text, page.Views },
    page,
    Views = page.Views
}

If I want to look at all pages that have stackoverflow in the text ordered by the most views, how would I query that in the RavenDB Studio?


Solution

  • When you are executing your query, There is an "Add Sort By" button. Click that, and you will get a drop-down list of indexed values available for sorting.

    In RavenDB 2.0, it looks like this:

    enter image description here

    If you're still on RavenDB 1.0, it looks a bit different:

    enter image description here