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
I like Al Dass solution of getting ids to operate on instead of complete large objects. Also getting the ids directly from the index. However the recursion scares me a bit (even though I think it might be ok) and I removed the reflection.
public List GetAllIds()
{
var allIds = new List();
IDocumentSession session = null;
try
{
session = documentStore.OpenSession();
int queryCount = 0;
int start = 0;
while (true)
{
var current = session.Advanced.DocumentQuery()
.Take(1024)
.Skip(start)
.SelectFields("__document_id")
.AddOrder("__document_id")
.ToList();
if (current.Count == 0)
break;
allIds.AddRange(current);
queryCount += 1;
start += current.Count;
if (queryCount == 30)
{
queryCount = 0;
session.Dispose();
session = documentStore.OpenSession();
}
}
}
finally
{
if (session != null)
{
session.Dispose();
}
}
return allIds;
}
also, this is updated to ravendb 3