Table of Contents

Class GroupOperation<TResult>

Namespace
MongoDB.Driver.Core.Operations
Assembly
MongoDB.Driver.Core.dll

Represents a group operation.

public class GroupOperation<TResult> : IReadOperation<IEnumerable<TResult>>

Type Parameters

TResult

The type of the result.

Inheritance
GroupOperation<TResult>
Implements
Inherited Members
Extension Methods

Constructors

GroupOperation(CollectionNamespace, BsonDocument, BsonDocument, BsonJavaScript, BsonDocument, MessageEncoderSettings)

Initializes a new instance of the GroupOperation<TResult> class.

public GroupOperation(CollectionNamespace collectionNamespace, BsonDocument key, BsonDocument initial, BsonJavaScript reduceFunction, BsonDocument filter, MessageEncoderSettings messageEncoderSettings)

Parameters

collectionNamespace CollectionNamespace

The collection namespace.

key BsonDocument

The key.

initial BsonDocument

The initial aggregation result for each group.

reduceFunction BsonJavaScript

The reduce function.

filter BsonDocument

The filter.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

GroupOperation(CollectionNamespace, BsonJavaScript, BsonDocument, BsonJavaScript, BsonDocument, MessageEncoderSettings)

Initializes a new instance of the GroupOperation<TResult> class.

public GroupOperation(CollectionNamespace collectionNamespace, BsonJavaScript keyFunction, BsonDocument initial, BsonJavaScript reduceFunction, BsonDocument filter, MessageEncoderSettings messageEncoderSettings)

Parameters

collectionNamespace CollectionNamespace

The collection namespace.

keyFunction BsonJavaScript

The key function.

initial BsonDocument

The initial aggregation result for each group.

reduceFunction BsonJavaScript

The reduce function.

filter BsonDocument

The filter.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

Properties

Collation

Gets or sets the collation.

public Collation Collation { get; set; }

Property Value

Collation

The collation.

CollectionNamespace

Gets the collection namespace.

public CollectionNamespace CollectionNamespace { get; }

Property Value

CollectionNamespace

The collection namespace.

Filter

Gets the filter.

public BsonDocument Filter { get; }

Property Value

BsonDocument

The filter.

FinalizeFunction

Gets or sets the finalize function.

public BsonJavaScript FinalizeFunction { get; set; }

Property Value

BsonJavaScript

The finalize function.

Initial

Gets the initial aggregation result for each group.

public BsonDocument Initial { get; }

Property Value

BsonDocument

The initial aggregation result for each group.

Key

Gets the key.

public BsonDocument Key { get; }

Property Value

BsonDocument

The key.

KeyFunction

Gets the key function.

public BsonJavaScript KeyFunction { get; }

Property Value

BsonJavaScript

The key function.

MaxTime

Gets or sets the maximum time the server should spend on this operation.

public TimeSpan? MaxTime { get; set; }

Property Value

TimeSpan?

The maximum time the server should spend on this operation.

MessageEncoderSettings

Gets the message encoder settings.

public MessageEncoderSettings MessageEncoderSettings { get; }

Property Value

MessageEncoderSettings

The message encoder settings.

ReduceFunction

Gets the reduce function.

public BsonJavaScript ReduceFunction { get; }

Property Value

BsonJavaScript

The reduce function.

ResultSerializer

Gets or sets the result serializer.

public IBsonSerializer<TResult> ResultSerializer { get; set; }

Property Value

IBsonSerializer<TResult>

The result serializer.

Methods

Execute(IReadBinding, CancellationToken)

Executes the operation.

public IEnumerable<TResult> Execute(IReadBinding binding, CancellationToken cancellationToken)

Parameters

binding IReadBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

IEnumerable<TResult>

The result of the operation.

ExecuteAsync(IReadBinding, CancellationToken)

Executes the operation.

public Task<IEnumerable<TResult>> ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)

Parameters

binding IReadBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IEnumerable<TResult>>

A Task whose result is the result of the operation.