Proper Way to Retrieve More than 128 Documents with RavenDB

前端 未结 5 1875
执念已碎
执念已碎 2020-12-13 01:07

I know variants of this question have been asked before (even by me), but I still don\'t understand a thing or two about this...

It was my understanding that one cou

5条回答
  •  情深已故
    2020-12-13 01:26

    It is worth noting that since version 2.5, RavenDB has an "unbounded results API" to allow streaming. The example from the docs shows how to use this:

    var query = session.Query("Users/ByActive").Where(x => x.Active);
    using (var enumerator = session.Advanced.Stream(query))
    {
        while (enumerator.MoveNext())
        {
            User activeUser = enumerator.Current.Document;
        }
    }
    

    There is support for standard RavenDB queries, Lucence queries and there is also async support.

    The documentation can be found here. Ayende's introductory blog article can be found here.

提交回复
热议问题