public static class Distinct.Builder extends Object
Distinct object.| Modifier and Type | Field and Description | 
|---|---|
| protected String | myKeyThe name of the key to collect distinct values for. | 
| protected Document | myQueryThe query to select document to perform a distinct query across. | 
| protected ReadPreference | myReadPreferenceThe read preference to use. | 
| Constructor and Description | 
|---|
| Distinct.Builder()Creates a new Builder. | 
| Modifier and Type | Method and Description | 
|---|---|
| Distinct | build()Creates a new  GroupBybased on the current state of the
 builder. | 
| Distinct.Builder | key(String key)Sets the name of the key to collect distinct values for. | 
| Distinct.Builder | query(DocumentAssignable query)Sets the value of the query to select the documents to run the
 distinct against. | 
| Distinct.Builder | readPreference(ReadPreference readPreference)Sets the  ReadPreferencespecifying which servers may be used
 to execute theDistinctcommand. | 
| Distinct.Builder | reset()Resets the builder back to its initial state. | 
| 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  ReadPreferencespecifying which servers may be used
 to execute theDistinctcommand. | 
protected String myKey
protected Document myQuery
protected ReadPreference myReadPreference
public Distinct build() throws IllegalArgumentException
GroupBy based on the current state of the
 builder.GroupBy based on the current state of the
         builder.IllegalArgumentException - If neither the key is null
             or empty.public Distinct.Builder key(String key)
 This method delegates to setKey(String).
 
key - The new name of the key to collect distinct values for.Distinct.Builder for method call chaining.public Distinct.Builder query(DocumentAssignable query)
 This method delegates to setQuery(DocumentAssignable).
 
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 readPreference(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.
 
 This method delegates to setReadPreference(ReadPreference).
readPreference - The read preferences specifying which servers may be used.MongoCollection.getReadPreference()public Distinct.Builder reset()
Distinct.Builder for method call chaining.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.