public class Find extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Find.Builder
Helper for creating immutable
Find queries. |
Modifier and Type | Field and Description |
---|---|
static Document |
ALL
An (empty) query document to find all documents.
|
Modifier | Constructor and Description |
---|---|
protected |
Find(Find.Builder builder)
Creates a new Find.
|
Modifier and Type | Method and Description |
---|---|
static Find.Builder |
builder()
Creates a new builder for a
Find . |
int |
getBatchSize()
Returns the number of documents to be returned in each batch of results.
|
Document |
getHint()
Returns the hint for which index to use.
|
String |
getHintName()
Returns the hint for which index to use by name.
|
int |
getLimit()
Returns the total number of documents to be returned.
|
long |
getMaximumDocumentsToScan()
Returns a value greater than zero to controls the maximum number of
documents that will be scanned for results.
|
Document |
getMaximumRange()
Returns a non-null value to controls the maximum value for the range
within the used index.
|
Document |
getMinimumRange()
Returns a non-null value to controls the minimum value for the range
within the used index.
|
int |
getNumberToSkip()
Returns the number of documents to skip before returning the first
document.
|
Document |
getQuery()
Returns the query document.
|
ReadPreference |
getReadPreference()
Returns the preference for the servers to retrieve the results from.
|
Document |
getReturnFields()
Returns the fields to be returned from the matching documents.
|
Document |
getSort()
Returns the fields to order document by.
|
boolean |
isAwaitData()
Returns true if the cursor returned from the query will block or wait for
data.
|
boolean |
isImmortalCursor()
Returns true if the cursor returned from the query will not timeout or
die automatically, e.g., immortal, false otherwise.
|
boolean |
isPartialOk()
Returns the partial okay value.
|
boolean |
isReturnIndexKeysOnly()
Returns true if only the index keys will be returned.
|
boolean |
isShowDiskLocation()
Returns true if a "$diskLoc" entry will be added to every returned
document with the disk location information.
|
boolean |
isSnapshot()
If returns true then use snapshot mode to ensure document are only
returned once.
|
boolean |
isTailable()
Returns true if the cursor returned from the query will be tailable,
false otherwise.
|
Document |
toQueryRequest(boolean explain)
This method is not intended for applications to use.
|
Document |
toQueryRequest(boolean explain,
ReadPreference readPreference)
This method is not intended for applications to use.
|
public static final Document ALL
protected Find(Find.Builder builder)
builder
- The builder to copy the query fields from.public static Find.Builder builder()
Find
.Find
.public int getBatchSize()
public Document getHint()
public String getHintName()
public int getLimit()
public long getMaximumDocumentsToScan()
public Document getMaximumRange()
public Document getMinimumRange()
public int getNumberToSkip()
public Document getQuery()
public ReadPreference getReadPreference()
null
in which case the default read preference should be
used.public Document getReturnFields()
public Document getSort()
public boolean isAwaitData()
Find.Builder.tailable()
cursors.public boolean isImmortalCursor()
Find.Builder.setimmortalCursor(boolean) for important usage
information.
public boolean isPartialOk()
public boolean isReturnIndexKeysOnly()
public boolean isShowDiskLocation()
public boolean isSnapshot()
public boolean isTailable()
Find.Builder.setTailable(boolean) for
important usage information.
public Document toQueryRequest(boolean explain)
Find
object to the appropriate method on the
MongoCollection
interface. This method is used internally by the
driver and is public for cross package access only.
Converts the Find
into a raw query request document to send to
the MongoDB server.
explain
- If true then explain the query procedure instead of returning
results.public Document toQueryRequest(boolean explain, ReadPreference readPreference)
Find
object to the appropriate method on the
MongoCollection
interface. This method is used internally by the
driver and is public for cross package access only.
Converts the Find
into a raw query request document to send to
the MongoDB server including the provided read preferences.
explain
- If true then explain the query procedure instead of returning
results.readPreference
- The read preference to include in the query request document.Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.