How-to create index on multiple documents with reducing

强颜欢笑 提交于 2020-01-13 05:37:30

问题


I've 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 query the list of books and have an information on each book if user has it in favorite.

Actually a result like this :

    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 perform that ?

Thanks.


回答1:


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

It shows how you can join the documents to show the favorite for the users.



来源:https://stackoverflow.com/questions/10141213/how-to-create-index-on-multiple-documents-with-reducing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!