reachify
reachify

Reputation: 3827

Ravendb retrieve all documents in collection for reporting

I need to retrieve all documents from a collection to dump it to an Excel file.

Using this seems to work

 var luceneQuery = Session.Advanced.LuceneQuery<Test.ReduceResult>("Test/ByTestData");
        var enumerator = Session.Advanced.Stream(luceneQuery);

        var obj = new List<Test.ReduceResult>();
        while (enumerator.MoveNext())
        {
            obj.Add(enumerator.Current.Document);
        }

This gives me all the results in the index. But instead of index I want to retrieve all the documents in a collection (as the index does not contain all the information stored in the document). How can this be done?

Upvotes: 0

Views: 116

Answers (1)

Ayende Rahien
Ayende Rahien

Reputation: 22956

Change your query to be:

 var luceneQuery = Session.Advanced.LuceneQuery<Test.ReduceResult>("Raven/DocumentsByEntityName")
    .WhereEquals("Tag", "Customers");

This will give you all customers.

Upvotes: 1

Related Questions