Amanda Kitson
Amanda Kitson

Reputation: 5547

RavenDB index with sorting not sorting

I have the following index created for RavenDB.

public class DayOfMonths_AllDaysSortedByOrder : AbstractIndexCreationTask<DayOfMonth, DayOfMonth>
    {
        public DayOfMonths_AllDaysSortedByOrder()
        {
            Map = days => from day in days select new { day };

            Sort(x => x.Order, Raven.Abstractions.Indexing.SortOptions.Int);
        }
    }

However, when I get the documents for this index, they are not returned in proper sorted order. What have I done wrong?

Upvotes: 1

Views: 571

Answers (1)

Bob Horn
Bob Horn

Reputation: 34297

Is it possible that your Map line should be like this?

Map = days => from day in days select new { day.Order };

Upvotes: 4

Related Questions