【发布时间】:2012-01-12 14:21:38
【问题描述】:
我是 RavenDB 的新手,据我了解,当您请求文档时,您将获得整个文档(除非您使用某种索引等)。
示例场景
以博客文档场景为例,文档如下所示:
public class Blog
{
public string Id { get; set; }
public string AuthorId { get; set; }
public DateTime PublishedUTC { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public Comment[] Comments { get; set; }
}
public class Comment
{
public string Id { get; set; }
public string AuthorId { get; set; }
public DateTime PublishedUTC { get; set; }
public string Content { get; set; }
}
假设我们有一个网页/blogs/posts/。该页面显示一组分页的博客文章和每个博客的评论。我了解如何使用 Skip() 和 Take() 方法在博客文档上使用分页。我想将分页逻辑应用于每个博客文档的内部 Comments 集合。
我的问题
如何获得一组分页的博客和一个分页集 他们的评论?
鉴于分页要求,您会更改给定的博客吗 记录场景,以便 cmets 不存在于博客中 文件?
【问题讨论】: