How to create an index for several documents with reduction

I have the following documents:

    public class User
    {
        public string Id { get; set; }
        public string Email { get; set; }
        public string Password { get; set; }
    }

    public class Book
    {
        public string Id { get; set; }
        public string Title { get; set; }
    }

    public class BookFavorite
    {
        public string Id { get; set; }
        public string UserId { get; set; }
        public string BookId { get; set; }
    }

I want to request a list of books and get information about each book, if the user has it in his favorites.

In fact, this result:

    public class QueryResult
    {
        public Book Book { get; set; }
        public User User { get; set; }
        public bool IsInFavorite { get; set; }
    }

How can I create my index to accomplish this?

Thank.

+3
source share
1 answer

Please look at this: http://ayende.com/blog/89089/ravendb-multi-maps-reduce-indexes

Shows how you can join documents to show your favorite to users.

+1
source

All Articles