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.
|
static Version |
MAX_TIMEOUT_VERSION
The first version of MongoDB to support the queries with the ability to
limit the execution time on the server.
|
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.
|
long |
getMaximumTimeMilliseconds()
Returns the maximum amount of time to allow the query to run on the
Server before it is aborted.
|
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 |
getProjection()
Returns the fields to be projected or returned from the matching
documents.
|
Document |
getQuery()
Returns the query document.
|
ReadPreference |
getReadPreference()
Returns the preference for the servers to retrieve the results from.
|
Document |
getReturnFields()
Deprecated.
Replaced with the MongoDB standardized name:
projection . This method will be
removed on or after the 1.4 release. |
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
public static final Version MAX_TIMEOUT_VERSION
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 long getMaximumTimeMilliseconds()
public Document getMinimumRange()
public int getNumberToSkip()
public Document getProjection()
public Document getQuery()
public ReadPreference getReadPreference()
null
in which case the default read preference should be
used.@Deprecated public Document getReturnFields()
projection
. This method will be
removed on or after the 1.4 release.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–2014 Allanbank Consulting, Inc.. All rights reserved.