public class GroupBy extends Object
GroupBy.Builder
is provided to assist in creating a
GroupBy
.Modifier and Type | Class and Description |
---|---|
static class |
GroupBy.Builder
Builder provides a builder for Group commands.
|
Modifier | Constructor and Description |
---|---|
protected |
GroupBy(GroupBy.Builder builder)
Creates a new GroupBy.
|
Modifier and Type | Method and Description |
---|---|
static GroupBy.Builder |
builder()
Creates a new builder for a
GroupBy . |
String |
getFinalizeFunction()
Returns the finalizer function to run for each group.
|
Document |
getInitialValue()
Returns the initial value for each group.
|
String |
getKeyFunction()
Returns the function to return the key for a document.
|
Set<String> |
getKeys()
Returns the fields to group by.
|
Document |
getQuery()
Returns the query to select the documents to run the group against.
|
ReadPreference |
getReadPreference()
Returns the
ReadPreference specifying which servers may be used
to execute the GroupBy command. |
String |
getReduceFunction()
Returns the reduce function taking the previous value and the current
value and returning the new reduced value.
|
protected GroupBy(GroupBy.Builder builder) throws IllegalArgumentException
builder
- The builder to copy the state from.IllegalArgumentException
- If neither the keys
nor
key function
have been set.public static GroupBy.Builder builder()
GroupBy
.GroupBy
.public String getFinalizeFunction()
public Document getInitialValue()
public String getKeyFunction()
getKeys()
to dynamically determine the group for each
document.getKeys()
to dynamically determine the group for each
document.public Set<String> getKeys()
public Document getQuery()
public ReadPreference getReadPreference()
ReadPreference
specifying which servers may be used
to execute the GroupBy
command.
If null
then the MongoCollection
instance's
ReadPreference
will be used.
MongoCollection.getReadPreference()
public String getReduceFunction()
Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.