public static class Distinct.Builder extends Object
Distinct object.| Modifier and Type | Field and Description |
|---|---|
protected String |
myKey
The name of the key to collect distinct values for.
|
protected Document |
myQuery
The query to select document to perform a distinct query across.
|
protected ReadPreference |
myReadPreference
The read preference to use.
|
| Constructor and Description |
|---|
Distinct.Builder() |
| Modifier and Type | Method and Description |
|---|---|
Distinct |
build()
Creates a new
GroupBy based on the current state of the
builder. |
Distinct.Builder |
setKey(String key)
Sets the name of the key to collect distinct values for.
|
Distinct.Builder |
setQuery(DocumentAssignable query)
Sets the value of the query to select the documents to run the
distinct against.
|
Distinct.Builder |
setReadPreference(ReadPreference readPreference)
Sets the
ReadPreference specifying which servers may be used
to execute the Distinct command. |
protected String myKey
protected Document myQuery
protected ReadPreference myReadPreference
public Distinct build() throws AssertionError
GroupBy based on the current state of the
builder.GroupBy based on the current state of the
builder.AssertionError - If neither the key is null
or empty.public Distinct.Builder setKey(String key)
key - The new name of the key to collect distinct values for.Distinct.Builder for method call chaining.public Distinct.Builder setQuery(DocumentAssignable query)
query - The new value for the query to select the documents to run
the distinct against.Distinct.Builder for method call chaining.public Distinct.Builder setReadPreference(ReadPreference readPreference)
ReadPreference specifying which servers may be used
to execute the Distinct command.
If not set or set to null then the
MongoCollection instance's ReadPreference will be
used.
readPreference - The read preferences specifying which servers may be used.MongoCollection.getReadPreference()Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.