MongoCollectionGroup Method (IMongoQuery, IMongoGroupBy, BsonDocument, BsonJavaScript, BsonJavaScript) |
Runs the group command on this collection.
Namespace: MongoDB.DriverAssembly: MongoDB.Driver.Legacy (in MongoDB.Driver.Legacy.dll) Version: 2.1.0
Syntax public virtual IEnumerable<BsonDocument> Group(
IMongoQuery query,
IMongoGroupBy keys,
BsonDocument initial,
BsonJavaScript reduce,
BsonJavaScript finalize
)
Public Overridable Function Group (
query As IMongoQuery,
keys As IMongoGroupBy,
initial As BsonDocument,
reduce As BsonJavaScript,
finalize As BsonJavaScript
) As IEnumerable(Of BsonDocument)
abstract Group :
query : IMongoQuery *
keys : IMongoGroupBy *
initial : BsonDocument *
reduce : BsonJavaScript *
finalize : BsonJavaScript -> IEnumerable<BsonDocument>
override Group :
query : IMongoQuery *
keys : IMongoGroupBy *
initial : BsonDocument *
reduce : BsonJavaScript *
finalize : BsonJavaScript -> IEnumerable<BsonDocument>
Parameters
- query
- Type: MongoDB.DriverIMongoQuery
The query (usually a QueryDocument or constructed using the Query builder). - keys
- Type: MongoDB.DriverIMongoGroupBy
The names of the fields 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:
IEnumerableBsonDocumentA list of results as BsonDocuments.
See Also