每个DocumentStore的WaitForNonStaleResults

Sib*_*Guy 7 .net nosql ravendb

有没有办法告诉RavenDb对某些DocumentStore或DocumentSession的所有查询使用WaitForNonStaleResults模式?

Car*_*des 10

您可以DefaultQueryingConsistency = ConsistencyOptions.QueryYourWrites在DocumentStore或Session级别使用.

DocumentStore:

IDocumentStore store = new DocumentStore {
    Url = "http://127.0.0.1:8080",
    DefaultDatabase = "DBNAME",
    Conventions = {
        DefaultQueryingConsistency = ConsistencyOptions.QueryYourWrites
    }
}.Initialize();
Run Code Online (Sandbox Code Playgroud)

会议:

session.Advanced.Conventions.DefaultQueryingConsistency = 
    ConsistencyOptions.QueryYourWrites;
Run Code Online (Sandbox Code Playgroud)

请记住,此机制不适用于Map-Reduce索引

您可以在下面查看Matt对此问题评论