Reputation: 834
Let's say I have a model that looks like this:
public class Blog
{
public string BlogId { get; set; }
public string Name { get; set; }
public DateTime Created { get; set; }
}
public class Post
{
public string PostId { get; set; }
public string BlogId { get; set; }
public string Text { get; set; }
}
I have many blogs, each with many posts. Now I want a "blog summary view" like this:
public class BlogSummaryView
{
public string Id { get; set; }
public string Name { get; set; }
public DateTime Created { get; set; }
public int PostCount { get; set; }
}
How should I go about to get this list if I want to be able to sort both on the creation date and the number of posts?
I can add a map/reduce index to get the number of posts per blog and sort on it, but I would not be able to sort on blog creation date with this index.
Adding a map index gives me the possibility to sort by creation date. This index would not allow me to sort on number of posts though, unless there is something I'm missing.
Upvotes: 2
Views: 680
Reputation: 22956
Kristoffer, That is why we have multi map reduce indexes. See: http://ayende.com/blog/89089/ravendb-multi-maps-reduce-indexes
Upvotes: 3