Is it possible to get the Statistics for a Stream Query?

21 views
Skip to first unread message

Justin A

unread,
Aug 9, 2017, 1:04:30 AM8/9/17
to RavenDB - 2nd generation document database

Hi :)

I with to retrieve about 12K documents from RavenDb. So far, I'm using the Stream way of doing it. 

e.g. 

                var query = documentSession.Query<Foo, Foos_FooResult>()
                                           .Statistics(out var statistics)
                                           .TransformWith<Foos_FooResultTransformer, FooResultTransformerThingy>();

                using (var enumerator = documentSession.Advanced.Stream(query))
                {
                    while (enumerator.MoveNext())
                    {
                        .... stuff ...
                    }
                }

For each item, I need to stick the document into a Dictionary (or any collection type). Instead of constantly dynamically increasing the size of the collection during the enumeration, I was hoping to set the size based on the size of the result set.

When I try and use the .statistics.TotalResults method in my query, I get statistics.TotalResults == 0.

Is there a way to do this?

cheers!

-me-

Oren Eini (Ayende Rahien)

unread,
Aug 9, 2017, 7:49:20 AM8/9/17
to ravendb
IEnumerator<StreamResult<T>> Stream<T>(IQueryable<T> query, out StreamQueryStatistics streamQueryStats);

You need to add it to the Stream method call

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin A

unread,
Aug 9, 2017, 9:44:33 AM8/9/17
to RavenDB - 2nd generation document database
thank you :) worked perfectly.
Reply all
Reply to author
Forward
0 new messages