Aggregation Framework - first batch behavior not clear

18 views
Skip to first unread message

Adrian Mindstorm

unread,
Mar 22, 2017, 9:35:47 AM3/22/17
to ReactiveMongo - http://reactivemongo.org
Hy guys,

In MongoDB documentation is stated:

cursor.batchSize(size)
Specifies the number of documents to return in each batch of the response from the MongoDB instance. 
In most cases, modifying the batch size will not affect the user or the application, as the mongo shell and most drivers return results as if MongoDB returned a single batch.

and in the documentation we have:
AggregationResult the property documents has been renamed to firstBatch, to clearly indicate it returns the first batch from result (which is frequently the single one).
(the emphasis and coloring pertains to me).

My question is:
In what situation the first batch returned is the single one and in what situations it is not.
How can I control that.
Neither ReactiveMongo, nor MongoDB documentation seem to be clear on the topic.
The question is posted on SO as well.

Many thanks in advance.
Adrian.
 

Cédric Chantepie

unread,
Mar 22, 2017, 1:51:08 PM3/22/17
to ReactiveMongo - http://reactivemongo.org
There is a single batch if the cursor option is not specified to the aggregate operation: http://reactivemongo.org/releases/0.12/documentation/release-details.html#aggregated-streams
Reply all
Reply to author
Forward
0 new messages