Package com.mongodb.operation
Class GroupOperation<T>
- java.lang.Object
 - 
- com.mongodb.operation.GroupOperation<T>
 
 
- 
- Type Parameters:
 T- the operations result type.
- All Implemented Interfaces:
 AsyncReadOperation<AsyncBatchCursor<T>>,ReadOperation<BatchCursor<T>>
@Deprecated public class GroupOperation<T> extends Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
Deprecated.Groups documents in a collection by the specified key and performs simple aggregation functions, such as computing counts and sums. The command is analogous to a SELECT ... GROUP BY statement in SQL.- Since:
 - 3.0
 - MongoDB documentation
 - Group Command
 
 
- 
- 
Constructor Summary
Constructors Constructor Description GroupOperation(MongoNamespace namespace, BsonJavaScript reduceFunction, BsonDocument initial, Decoder<T> decoder)Deprecated.Create an operation that will perform a Group on a given collection. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description GroupOperation<T>collation(Collation collation)Deprecated.Sets the collation optionsBatchCursor<T>execute(ReadBinding binding)Deprecated.Will return a cursor of Documents containing the results of the group operation.voidexecuteAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback)Deprecated.General execute which can return anything of type TGroupOperation<T>filter(BsonDocument filter)Deprecated.Sets the optional query filter to determine which documents in the collection to process.GroupOperation<T>finalizeFunction(BsonJavaScript finalizeFunction)Deprecated.Sets the function that runs each item in the result set before returning the final value.CollationgetCollation()Deprecated.Returns the collation optionsDecoder<T>getDecoder()Deprecated.Gets the decoder used to decode the result documents.BsonDocumentgetFilter()Deprecated.Gets the query filter to determine which documents in the collection to process.BsonJavaScriptgetFinalizeFunction()Deprecated.Gets the function that runs each item in the result before returning the final value.BsonDocumentgetInitial()Deprecated.Gets the initial the aggregation result document.BsonDocumentgetKey()Deprecated.Gets the document containing the field or fields to group.BsonJavaScriptgetKeyFunction()Deprecated.Gets the function that creates a "key object" for use as the grouping key.MongoNamespacegetNamespace()Deprecated.Gets the namespace.BsonJavaScriptgetReduceFunction()Deprecated.Gets the aggregation function that operates on the documents during the grouping operation.booleangetRetryReads()Deprecated.Gets the value for retryable reads.GroupOperation<T>key(BsonDocument key)Deprecated.Sets the document containing the field or fields to group.GroupOperation<T>keyFunction(BsonJavaScript keyFunction)Deprecated.Sets the function that creates a "key object" for use as the grouping key.GroupOperation<T>retryReads(boolean retryReads)Deprecated.Enables retryable reads if a read fails due to a network error. 
 - 
 
- 
- 
Constructor Detail
- 
GroupOperation
public GroupOperation(MongoNamespace namespace, BsonJavaScript reduceFunction, BsonDocument initial, Decoder<T> decoder)
Deprecated.Create an operation that will perform a Group on a given collection.- Parameters:
 namespace- the database and collection namespace for the operation.reduceFunction- The aggregation function that operates on the documents during the grouping operation.initial- The initial the aggregation result document.decoder- the decoder for the result documents.- MongoDB documentation
 - Group Command
 
 
 - 
 
- 
Method Detail
- 
getNamespace
public MongoNamespace getNamespace()
Deprecated.Gets the namespace.- Returns:
 - the namespace
 - Since:
 - 3.4
 
 
- 
getDecoder
public Decoder<T> getDecoder()
Deprecated.Gets the decoder used to decode the result documents.- Returns:
 - the decoder
 - Since:
 - 3.4
 
 
- 
getKey
public BsonDocument getKey()
Deprecated.Gets the document containing the field or fields to group.- Returns:
 - the document containing the field or fields to group.
 
 
- 
key
public GroupOperation<T> key(BsonDocument key)
Deprecated.Sets the document containing the field or fields to group.- Parameters:
 key- the document containing the field or fields to group.- Returns:
 - this
 
 
- 
getKeyFunction
public BsonJavaScript getKeyFunction()
Deprecated.Gets the function that creates a "key object" for use as the grouping key.- Returns:
 - the function that creates a "key object" for use as the grouping key.
 
 
- 
keyFunction
public GroupOperation<T> keyFunction(BsonJavaScript keyFunction)
Deprecated.Sets the function that creates a "key object" for use as the grouping key.- Parameters:
 keyFunction- the function that creates a "key object" for use as the grouping key.- Returns:
 - this
 
 
- 
getInitial
public BsonDocument getInitial()
Deprecated.Gets the initial the aggregation result document.- Returns:
 - the initial the aggregation result document.
 
 
- 
getReduceFunction
public BsonJavaScript getReduceFunction()
Deprecated.Gets the aggregation function that operates on the documents during the grouping operation.- Returns:
 - the aggregation function that operates on the documents during the grouping operation.
 
 
- 
getFilter
public BsonDocument getFilter()
Deprecated.Gets the query filter to determine which documents in the collection to process.- Returns:
 - the query filter to determine which documents in the collection to process.
 
 
- 
filter
public GroupOperation<T> filter(BsonDocument filter)
Deprecated.Sets the optional query filter to determine which documents in the collection to process.- Parameters:
 filter- the query filter to determine which documents in the collection to process.- Returns:
 - this
 
 
- 
getFinalizeFunction
public BsonJavaScript getFinalizeFunction()
Deprecated.Gets the function that runs each item in the result before returning the final value.- Returns:
 - the function that runs each item in the result set before returning the final value.
 
 
- 
finalizeFunction
public GroupOperation<T> finalizeFunction(BsonJavaScript finalizeFunction)
Deprecated.Sets the function that runs each item in the result set before returning the final value.- Parameters:
 finalizeFunction- the function that runs each item in the result set before returning the final value.- Returns:
 - this
 
 
- 
getCollation
public Collation getCollation()
Deprecated.Returns the collation options- Returns:
 - the collation options
 - Since:
 - 3.4
 - Since server release
 - 3.4
 
 
- 
collation
public GroupOperation<T> collation(Collation collation)
Deprecated.Sets the collation optionsA null value represents the server default.
- Parameters:
 collation- the collation options to use- Returns:
 - this
 - Since:
 - 3.4
 - Since server release
 - 3.4
 
 
- 
retryReads
public GroupOperation<T> retryReads(boolean retryReads)
Deprecated.Enables retryable reads if a read fails due to a network error.- Parameters:
 retryReads- true if reads should be retried- Returns:
 - this
 - Since:
 - 3.11
 
 
- 
getRetryReads
public boolean getRetryReads()
Deprecated.Gets the value for retryable reads. The default is true.- Returns:
 - the retryable reads value
 - Since:
 - 3.11
 
 
- 
execute
public BatchCursor<T> execute(ReadBinding binding)
Deprecated.Will return a cursor of Documents containing the results of the group operation.- Specified by:
 executein interfaceReadOperation<T>- Parameters:
 binding- the binding- Returns:
 - a MongoCursor of T, the results of the group operation in a form to be iterated over.
 
 
- 
executeAsync
public void executeAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback)
Deprecated.Description copied from interface:AsyncReadOperationGeneral execute which can return anything of type T- Specified by:
 executeAsyncin interfaceAsyncReadOperation<T>- Parameters:
 binding- the binding to execute in the context ofcallback- the callback to be called when the operation has been executed
 
 - 
 
 -