WaitForNonStaleResults per DocumentStore

做~自己de王妃 提交于 2019-12-01 15:45:38

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/8554650/waitfornonstaleresults-per-documentstore

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!