问题
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