Retrieving entire data collection from a RavenDB

前端 未结 6 949
囚心锁ツ
囚心锁ツ 2021-02-01 21:55

I have a requirement where I need to fetch the entire data collection Users from RavenDB and compare the retrieved result set with another set of data. There are cl

6条回答
  •  长情又很酷
    2021-02-01 22:27

    You use paging, and read this 1024 items at a time.

    int start = 0;
    while(true)
    {
       var current = session.Query().Take(1024).Skip(start).ToList();
       if(current.Count == 0)
              break;
    
       start+= current.Count;
       allUsers.AddRange(current);
    
    }
    

提交回复
热议问题