Click or drag to resize

MongoCollectionGroup Method (IMongoQuery, BsonJavaScript, BsonDocument, BsonJavaScript, BsonJavaScript)

Note: This API is now obsolete.

Runs the group command on this collection.

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver.Legacy (in MongoDB.Driver.Legacy.dll) Version: 2.16.0+eeafbea0921243a5868b81984e1083a07c1f75bc
Syntax
[ObsoleteAttribute("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
Type: MongoDB.DriverIMongoQuery
The query (usually a QueryDocument or constructed using the Query builder).
keyFunction
Type: MongoDB.BsonBsonJavaScript
A JavaScript function that returns the key value to group on.
initial
Type: MongoDB.BsonBsonDocument
Initial value passed to the reduce function for each group.
reduce
Type: MongoDB.BsonBsonJavaScript
A JavaScript function that is called for each matching document in a group.
finalize
Type: MongoDB.BsonBsonJavaScript
A JavaScript function that is called at the end of the group command.

Return Value

Type: IEnumerableBsonDocument
A list of results as BsonDocuments.
See Also