public static class Find.Builder extends Object
Find queries.| Modifier and Type | Field and Description | 
|---|---|
| protected int | myBatchSizeThe number of documents to be returned in each batch of results. | 
| protected Document | myHintThe hint for which index to use. | 
| protected String | myHintNameThe hint for which index to use. | 
| protected int | myLimitThe total number of documents to be returned. | 
| protected int | myNumberToSkipThe number of documents to skip before returning the first document. | 
| protected boolean | myPartialOkIf true then an error in the query should return any partial results. | 
| protected Document | myQueryThe query document. | 
| protected ReadPreference | myReadPreferenceThe preference for which servers to use to retrieve the results. | 
| protected Document | myReturnFieldsThe fields to be returned from the matching documents. | 
| protected boolean | mySnapshotIf set to true then use snapshot mode to ensure document are only
 returned once. | 
| protected Document | mySortThe fields to order the document on. | 
| protected boolean | myTailableIf set to true the cursur returned from the query will be tailable. | 
| Constructor and Description | 
|---|
| Find.Builder()Creates a new Builder. | 
| Find.Builder(DocumentAssignable query)Creates a new Builder. | 
| Modifier and Type | Method and Description | 
|---|---|
| Find | build()Constructs a new  Findobject from the state of the builder. | 
| Find.Builder | partialOk()Sets that if there is an error then the query should return any
 partial results. | 
| Find.Builder | reset()Resets the builder back to its initial state for reuse. | 
| Find.Builder | setBatchSize(int batchSize)Sets the value of the number of documents to be returned in each
 batch. | 
| Find.Builder | setHint(DocumentAssignable indexFields)Sets the value of hint as to which index should be used to execute
 the query. | 
| Find.Builder | setHint(IntegerElement... indexFields)Sets the value of hint as to which index should be used to execute
 the query. | 
| Find.Builder | setHint(String indexName)Sets the value of hint as to which index should be used to execute
 the query. | 
| Find.Builder | setLimit(int limit)Sets the value of the total number of documents to be returned. | 
| Find.Builder | setNumberToSkip(int numberToSkip)Sets the value of the number of documents to skip before returning
 the first document to the new value. | 
| Find.Builder | setPartialOk(boolean partialOk)Sets the value of partial okay to the new value. | 
| Find.Builder | setQuery(DocumentAssignable query)Sets the value of the query document to the new value. | 
| Find.Builder | setReadPreference(ReadPreference readPreference)Sets the preference for the set of servers to retrieve the results
 from. | 
| Find.Builder | setReturnFields(DocumentAssignable returnFields)Sets the value of the fields to be returned from the matching
 documents to the new value. | 
| Find.Builder | setSnapshot(boolean snapshot)Sets the value of snapshot to the new value. | 
| Find.Builder | setSort(DocumentAssignable sortFields)Sets the value of the fields to to sort matching documents by. | 
| Find.Builder | setSort(IntegerElement... sortFields)Sets the value of the fields to to sort matching documents by. | 
| Find.Builder | setTailable(boolean tailable)If set to true the cursur returned from the query will be tailable. | 
| Find.Builder | snapshot()Sets that the query should ensure that documents are only returned
 once. | 
| Find.Builder | tailable()Sets the the cursur returned from the query to be tailable. | 
protected int myBatchSize
protected Document myHint
protected String myHintName
protected int myLimit
protected int myNumberToSkip
protected boolean myPartialOk
protected Document myQuery
protected ReadPreference myReadPreference
protected Document myReturnFields
protected boolean mySnapshot
protected Document mySort
protected boolean myTailable
public Find.Builder()
public Find.Builder(DocumentAssignable query)
query - The query document.public Find build()
Find object from the state of the builder.Find object.public Find.Builder partialOk()
public Find.Builder reset()
public Find.Builder setBatchSize(int batchSize)
batchSize - The new value for the number of documents to be returned
            in each batch.public Find.Builder setHint(DocumentAssignable indexFields)
indexFields - The new value for the fields of the index to use to
            execute the query.public Find.Builder setHint(IntegerElement... indexFields)
 This method is intended to be used with the Sort class's
 static methods: 
import staticcom.allanbank.mongodb.builder.Sort.asc; import staticcom.allanbank.mongodb.builder.Sort.desc; Find.Builder builder = new Find.Builder(); builder.setHint( asc("f"), desc("g") ); ...
indexFields - The new value for the fields of the index to use to
            execute the query.public Find.Builder setHint(String indexName)
indexName - The new value for the name of the index to use to execute
            the query.public Find.Builder setLimit(int limit)
limit - The new value for the total number of documents to be
            returned.public Find.Builder setNumberToSkip(int numberToSkip)
numberToSkip - The new value for the number of documents to skip before
            returning the first document.public Find.Builder setPartialOk(boolean partialOk)
partialOk - The new value for the partial okay.public Find.Builder setQuery(DocumentAssignable query)
query - The new value for the query document.public Find.Builder setReadPreference(ReadPreference readPreference)
readPreference - The new value for the preference of which server to return
            the results from.public Find.Builder setReturnFields(DocumentAssignable returnFields)
returnFields - The new value for the fields to be returned from the
            matching documents.public Find.Builder setSnapshot(boolean snapshot)
snapshot - The new value for the partial okay.public Find.Builder setSort(DocumentAssignable sortFields)
sortFields - The new value for the fields to sort matching documents
            by.public Find.Builder setSort(IntegerElement... sortFields)
 This method is intended to be used with the Sort class's
 static methods: 
import staticcom.allanbank.mongodb.builder.Sort.asc; import staticcom.allanbank.mongodb.builder.Sort.desc; Find.Builder builder = new Find.Builder(); builder.setSort( asc("f"), desc("g") ); ...
sortFields - The new value for the fields to sort matching documents
            by.public Find.Builder setTailable(boolean tailable)
 Testing has shown that a tailable cursor on an empty collection will
 not setup a cursor on the MongoDB server and will immediately return
 false from Iterator.hasNext().
 
 When using a tailable cursor that has exhausted the available data
 will cause the Iterator.hasNext() calls to block
 until more data is available. The connection that is used to request
 more documents will also be blocked for short intervals (measured to
 be ~2.25 seconds with 2.0.7). Any requests submitted behind the
 cursors request will also be blocked.
 
 It is highly recommended that the number of connections within the
 MongoClientConfiguration be at least 1 more than the maximum
 number of active tailable cursors.
 
tailable - The new value for if the cursur returned from the query
            will be tailable.public Find.Builder snapshot()
public Find.Builder tailable()
setTailable(boolean) for important usage
      information.Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.