Table of Contents

Class MapReduceOperationBase

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

Represents a base class for map-reduce operations.

[Obsolete("Use Aggregation pipeline instead.")]
public abstract class MapReduceOperationBase
Inheritance
MapReduceOperationBase
Derived
Inherited Members

Constructors

MapReduceOperationBase(CollectionNamespace, BsonJavaScript, BsonJavaScript, MessageEncoderSettings)

Initializes a new instance of the MapReduceOperationBase class.

protected MapReduceOperationBase(CollectionNamespace collectionNamespace, BsonJavaScript mapFunction, BsonJavaScript reduceFunction, MessageEncoderSettings messageEncoderSettings)

Parameters

collectionNamespace CollectionNamespace

The collection namespace.

mapFunction BsonJavaScript

The map function.

reduceFunction BsonJavaScript

The reduce function.

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 or sets the filter.

public BsonDocument Filter { get; set; }

Property Value

BsonDocument

The filter.

FinalizeFunction

Gets or sets the finalize function.

public BsonJavaScript FinalizeFunction { get; set; }

Property Value

BsonJavaScript

The finalize function.

JavaScriptMode

Gets or sets a value indicating whether objects emitted by the map function remain as JavaScript objects.

[Obsolete("JavaScriptMode is ignored by server versions 4.4.0 and newer.")]
public bool? JavaScriptMode { get; set; }

Property Value

bool?
Setting this value to true can result in faster execution, but requires more memory on the server, and if there are too many emitted objects the map-reduce operation may fail. true if objects emitted by the map function remain as JavaScript objects; otherwise, false.

Limit

Gets or sets the maximum number of documents to pass to the map function.

public long? Limit { get; set; }

Property Value

long?

The maximum number of documents to pass to the map function.

MapFunction

Gets the map function.

public BsonJavaScript MapFunction { get; }

Property Value

BsonJavaScript

The map 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.

Scope

Gets or sets the scope document.

public BsonDocument Scope { get; set; }

Property Value

BsonDocument

The scope document.

Remarks

The scode document defines global variables that are accessible from the map, reduce and finalize functions.

Sort

Gets or sets the sort specification.

public BsonDocument Sort { get; set; }

Property Value

BsonDocument

The sort specification.

Verbose

Gets or sets a value indicating whether to include extra information, such as timing, in the result.

public bool? Verbose { get; set; }

Property Value

bool?

true if extra information, such as timing, should be included in the result; otherwise, false.

Methods

CreateCommand(ICoreSessionHandle, ConnectionDescription)

Creates the command.

protected virtual BsonDocument CreateCommand(ICoreSessionHandle session, ConnectionDescription connectionDescription)

Parameters

session ICoreSessionHandle

The session.

connectionDescription ConnectionDescription

The connection description.

Returns

BsonDocument

The command.

CreateOutputOptions()

Creates the output options.

protected abstract BsonDocument CreateOutputOptions()

Returns

BsonDocument

The output options.