1

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?

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
scottm
  • 27,829
  • 22
  • 107
  • 159

1 Answers1

6

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

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
  • What may not be obvious though is that only indexed fields are available for sorting. You will get the whole document back, but you must map the sort fields in the index. – Matt Johnson-Pint Nov 27 '12 at 20:29