Table of Contents

Method Group

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Legacy.dll

Group(GroupArgs)

Runs the group command on this collection.

[Obsolete("The group command was deprecated in server version 3.4.")]
public virtual IEnumerable<BsonDocument> Group(GroupArgs args)

Parameters

args GroupArgs

The args.

Returns

IEnumerable<BsonDocument>

A list of results as BsonDocuments.

Group(IMongoQuery, BsonJavaScript, BsonDocument, BsonJavaScript, BsonJavaScript)

Runs the group command on this collection.

[Obsolete("The group command was deprecated in server version 3.4.")]
public virtual IEnumerable<BsonDocument> Group(IMongoQuery query, BsonJavaScript keyFunction, BsonDocument initial, BsonJavaScript reduce, BsonJavaScript finalize)

Parameters

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

keyFunction BsonJavaScript

A JavaScript function that returns the key value to group on.

initial BsonDocument

Initial value passed to the reduce function for each group.

reduce BsonJavaScript

A JavaScript function that is called for each matching document in a group.

finalize BsonJavaScript

A JavaScript function that is called at the end of the group command.

Returns

IEnumerable<BsonDocument>

A list of results as BsonDocuments.

Group(IMongoQuery, IMongoGroupBy, BsonDocument, BsonJavaScript, BsonJavaScript)

Runs the group command on this collection.

[Obsolete("The group command was deprecated in server version 3.4.")]
public virtual IEnumerable<BsonDocument> Group(IMongoQuery query, IMongoGroupBy keys, BsonDocument initial, BsonJavaScript reduce, BsonJavaScript finalize)

Parameters

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

keys IMongoGroupBy

The names of the fields to group on.

initial BsonDocument

Initial value passed to the reduce function for each group.

reduce BsonJavaScript

A JavaScript function that is called for each matching document in a group.

finalize BsonJavaScript

A JavaScript function that is called at the end of the group command.

Returns

IEnumerable<BsonDocument>

A list of results as BsonDocuments.

Group(IMongoQuery, string, BsonDocument, BsonJavaScript, BsonJavaScript)

Runs the group command on this collection.

[Obsolete("The group command was deprecated in server version 3.4.")]
public virtual IEnumerable<BsonDocument> Group(IMongoQuery query, string key, BsonDocument initial, BsonJavaScript reduce, BsonJavaScript finalize)

Parameters

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

key string

The name of the field to group on.

initial BsonDocument

Initial value passed to the reduce function for each group.

reduce BsonJavaScript

A JavaScript function that is called for each matching document in a group.

finalize BsonJavaScript

A JavaScript function that is called at the end of the group command.

Returns

IEnumerable<BsonDocument>

A list of results as BsonDocuments.