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
-
Constructor Summary
ConstructorsConstructorDescriptionGroupOperation
(MongoNamespace namespace, BsonJavaScript reduceFunction, BsonDocument initial, Decoder<T> decoder) Deprecated.Create an operation that will perform a Group on a given collection. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Sets the collation optionsexecute
(ReadBinding binding) Deprecated.Will return a cursor of Documents containing the results of the group operation.void
executeAsync
(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback) Deprecated.General execute which can return anything of type Tfilter
(BsonDocument filter) Deprecated.Sets the optional query filter to determine which documents in the collection to process.finalizeFunction
(BsonJavaScript finalizeFunction) Deprecated.Sets the function that runs each item in the result set before returning the final value.Deprecated.Returns the collation optionsDeprecated.Gets the decoder used to decode the result documents.Deprecated.Gets the query filter to determine which documents in the collection to process.Deprecated.Gets the function that runs each item in the result before returning the final value.Deprecated.Gets the initial the aggregation result document.getKey()
Deprecated.Gets the document containing the field or fields to group.Deprecated.Gets the function that creates a "key object" for use as the grouping key.Deprecated.Gets the namespace.Deprecated.Gets the aggregation function that operates on the documents during the grouping operation.boolean
Deprecated.Gets the value for retryable reads.key
(BsonDocument key) Deprecated.Sets the document containing the field or fields to group.keyFunction
(BsonJavaScript keyFunction) Deprecated.Sets the function that creates a "key object" for use as the grouping key.retryReads
(boolean retryReads) Deprecated.Enables retryable reads if a read fails due to a network error.
-
Constructor Details
-
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.
-
-
Method Details
-
getNamespace
Deprecated.Gets the namespace.- Returns:
- the namespace
- Since:
- 3.4
-
getDecoder
Deprecated.Gets the decoder used to decode the result documents.- Returns:
- the decoder
- Since:
- 3.4
-
getKey
Deprecated.Gets the document containing the field or fields to group.- Returns:
- the document containing the field or fields to group.
-
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
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
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
Deprecated.Gets the initial the aggregation result document.- Returns:
- the initial the aggregation result document.
-
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
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
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
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
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
Deprecated.Returns the collation options- Returns:
- the collation options
- Since:
- 3.4
-
collation
Deprecated.Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
- Since:
- 3.4
-
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
Deprecated.Will return a cursor of Documents containing the results of the group operation.- Specified by:
execute
in 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:AsyncReadOperation
General execute which can return anything of type T- Specified by:
executeAsync
in interfaceAsyncReadOperation<T>
- Parameters:
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed
-