質問

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