Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WaitForNonStaleResults per DocumentStore

Is there any way to tell RavenDb to use WaitForNonStaleResults mode for all queries of some DocumentStore or DocumentSession?

like image 582
SiberianGuy Avatar asked Dec 18 '11 20:12

SiberianGuy


1 Answers

You can use DefaultQueryingConsistency = ConsistencyOptions.QueryYourWrites at the DocumentStore or Session level.

DocumentStore:

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

Session:

session.Advanced.Conventions.DefaultQueryingConsistency = 
    ConsistencyOptions.QueryYourWrites;

Bear in mind that this mechanism does not work for Map-Reduce Indexes

You can check Matt's comments on this matter below

like image 186
Carlos Mendes Avatar answered Nov 14 '22 13:11

Carlos Mendes