문제

I have RavenDB Versioning enabled and I have documents that look like this:

{
    Id: "mydoc/5",
    Count: 3,
    ... other data ...
}

I have an index that will return all documents that have a Count < 10.

docs.MyDocs.Where(mydoc => mydoc.Count < 10).Select(mydoc => 
new { Query = mydoc.Select(x => x.Value) });

When this query runs, I get results like this:

mydoc/5/revisions/1
{
    Id: "mydoc/5/revisions/1",
    Count: 2,
    ... other data ...
}

mydoc/5/revisions/2
{
    Id: "mydoc/5/revisions/2",
    Count: 3,
    ... other data ...
}

mydoc/5
{
    Id: "mydoc/5",
    Count: 3,
    ... other data ...
}

How should I change my index so it stops indexing the revisions of the documents and only returns the current version?

도움이 되었습니까?

해결책

You can manipulate the index query to filter out all but "current" version. See: http://www.mostlylucid.co.uk/archive/2010/07/12/handy-indexes-for-versioning-with-ravendb.aspx

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top