RavenDb Index Sort

Imagine that we have the simplest map index:

Map = posts => from post in posts orderby post.DateTime select new { Id = post.Id, DateTime = post.DateTime } 

How will an OrderBy condition affect Map index results? Does it determine the default order order if your request does not provide an order proposal explicitly? How are documents sorted if the proposal was not submitted either in the index or in the request?

+4
source share
1 answer

This order of by will be ignored altogether - it does not affect how the index is executed. By default (unless you specify a specific order), you will have a lexicographic order.

You can either specify the order on the index itself (see here: http://ravendb.net/docs/client-api/querying/static-indexes/customizing-results-order ) or at the time of the request.

+5
source

Source: https://habr.com/ru/post/1393788/


All Articles