| Class | Mongo::Operation::Aggregate::Result |
| In: |
lib/mongo/operation/aggregate/result.rb
|
| Parent: | Operation::Result |
Defines custom behavior of results in an aggregation context.
@since 2.0.0
| EXPLAIN | = | 'stages'.freeze |
The field name for the aggregation explain information.
@since 2.0.5 |
|
| EXPLAIN_LEGACY | = | 'serverPipeline'.freeze |
The legacy field name for the aggregation explain information.
@since 2.0.5 |
Get the cursor id for the result.
@example Get the cursor id.
result.cursor_id
@note Even though the wire protocol has a cursor_id field for all
messages of type reply, it is always zero when using the aggregation framework and must be retrieved from the cursor document itself. Wahnsinn!
@return [ Integer ] The cursor id.
@since 2.0.0
Get the documents for the aggregation result. This is either the first document‘s ‘result’ field, or if a cursor option was selected it is the ‘firstBatch’ field in the ‘cursor’ field of the first document returned.
@example Get the documents.
result.documents
@return [ Array<BSON::Document> ] The documents.
@since 2.0.0