Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get ALL docs from any collection in RavenDB
using Raven.Client;
public class RavenSearch
{
private IEnumerable<T> GetAllResults<T>(IDocumentSession session) where T : class
{
session.Advanced.MaxNumberOfRequestsPerSession = 1000;
int skip = 0;
var results = new List<T>();
var query = session.Query<T>();
var totalCount = query.Count();
while (skip < totalCount)
{
results.AddRange(query.Skip(skip).Take(1024).ToList());
skip += 1024;
}
return results;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment