T - the operations result type.public class FindOperation<T> extends Object implements AsyncReadOperation<AsyncBatchCursor<T>>, ReadOperation<BatchCursor<T>>
| Constructor and Description | 
|---|
| FindOperation(MongoNamespace namespace,
             Decoder<T> decoder)Construct a new instance. | 
| Modifier and Type | Method and Description | 
|---|---|
| ReadOperation<BsonDocument> | asExplainableOperation(ExplainVerbosity explainVerbosity)Gets an operation whose execution explains this operation. | 
| AsyncReadOperation<BsonDocument> | asExplainableOperationAsync(ExplainVerbosity explainVerbosity)Gets an operation whose execution explains this operation. | 
| FindOperation<T> | batchSize(int batchSize)Sets the number of documents to return per batch. | 
| FindOperation<T> | collation(Collation collation)Sets the collation options | 
| FindOperation<T> | cursorType(CursorType cursorType)Sets the cursor type. | 
| BatchCursor<T> | execute(ReadBinding binding)General execute which can return anything of type T | 
| void | executeAsync(AsyncReadBinding binding,
            SingleResultCallback<AsyncBatchCursor<T>> callback)General execute which can return anything of type T | 
| FindOperation<T> | filter(BsonDocument filter)Sets the query filter to apply to the query. | 
| int | getBatchSize()Gets the number of documents to return per batch. | 
| Collation | getCollation()Returns the collation options | 
| CursorType | getCursorType()Get the cursor type. | 
| Decoder<T> | getDecoder()Gets the decoder used to decode the result documents. | 
| BsonDocument | getFilter()Gets the query filter. | 
| int | getLimit()Gets the limit to apply. | 
| long | getMaxAwaitTime(TimeUnit timeUnit)The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor
 query. | 
| long | getMaxTime(TimeUnit timeUnit)Gets the maximum execution time on the server for this operation. | 
| BsonDocument | getModifiers()Gets the query modifiers to apply to this operation. | 
| MongoNamespace | getNamespace()Gets the namespace. | 
| BsonDocument | getProjection()Gets a document describing the fields to return for all matching documents. | 
| ReadConcern | getReadConcern()Gets the read concern | 
| int | getSkip()Gets the number of documents to skip. | 
| BsonDocument | getSort()Gets the sort criteria to apply to the query. | 
| boolean | isNoCursorTimeout()Returns true if cursor timeout has been turned off. | 
| boolean | isOplogReplay()Internal replication use only. | 
| boolean | isPartial()Returns true if can get partial results from a mongos if some shards are down. | 
| boolean | isSlaveOk()Returns true if set to allowed to query non-primary replica set members. | 
| FindOperation<T> | limit(int limit)Sets the limit to apply. | 
| FindOperation<T> | maxAwaitTime(long maxAwaitTime,
            TimeUnit timeUnit)Sets the maximum await execution time on the server for this operation. | 
| FindOperation<T> | maxTime(long maxTime,
       TimeUnit timeUnit)Sets the maximum execution time on the server for this operation. | 
| FindOperation<T> | modifiers(BsonDocument modifiers)Sets the query modifiers to apply to this operation. | 
| FindOperation<T> | noCursorTimeout(boolean noCursorTimeout)Sets if the cursor timeout should be turned off. | 
| FindOperation<T> | oplogReplay(boolean oplogReplay)Internal replication use only. | 
| FindOperation<T> | partial(boolean partial)Sets if partial results from a mongos if some shards are down are allowed | 
| FindOperation<T> | projection(BsonDocument projection)Sets a document describing the fields to return for all matching documents. | 
| FindOperation<T> | readConcern(ReadConcern readConcern)Sets the read concern | 
| FindOperation<T> | skip(int skip)Sets the number of documents to skip. | 
| FindOperation<T> | slaveOk(boolean slaveOk)Sets if allowed to query non-primary replica set members. | 
| FindOperation<T> | sort(BsonDocument sort)Sets the sort criteria to apply to the query. | 
public FindOperation(MongoNamespace namespace, Decoder<T> decoder)
namespace - the database and collection namespace for the operation.decoder - the decoder for the result documents.public MongoNamespace getNamespace()
public Decoder<T> getDecoder()
public BsonDocument getFilter()
public FindOperation<T> filter(BsonDocument filter)
filter - the filter, which may be null.public int getBatchSize()
public FindOperation<T> batchSize(int batchSize)
batchSize - the batch sizepublic int getLimit()
public FindOperation<T> limit(int limit)
limit - the limit, which may be nullpublic BsonDocument getModifiers()
public FindOperation<T> modifiers(BsonDocument modifiers)
modifiers - the query modifiers to apply, which may be null.public BsonDocument getProjection()
public FindOperation<T> projection(BsonDocument projection)
projection - the project document, which may be null.public long getMaxTime(TimeUnit timeUnit)
timeUnit - the time unit to return the result inpublic FindOperation<T> maxTime(long maxTime, TimeUnit timeUnit)
maxTime - the max timetimeUnit - the time unit, which may not be nullpublic long getMaxAwaitTime(TimeUnit timeUnit)
timeUnit - the time unit to return the result inpublic FindOperation<T> maxAwaitTime(long maxAwaitTime, TimeUnit timeUnit)
maxAwaitTime - the max await time.  A zero value will be ignored, and indicates that the driver should respect the server's
                      default valuetimeUnit - the time unit, which may not be nullpublic int getSkip()
public FindOperation<T> skip(int skip)
skip - the number of documents to skippublic BsonDocument getSort()
public FindOperation<T> sort(BsonDocument sort)
sort - the sort criteria, which may be null.public CursorType getCursorType()
public FindOperation<T> cursorType(CursorType cursorType)
cursorType - the cursor typepublic boolean isSlaveOk()
public FindOperation<T> slaveOk(boolean slaveOk)
slaveOk - true if allowed to query non-primary replica set members.public boolean isOplogReplay()
public FindOperation<T> oplogReplay(boolean oplogReplay)
oplogReplay - the oplogReplay valuepublic boolean isNoCursorTimeout()
The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use.
public FindOperation<T> noCursorTimeout(boolean noCursorTimeout)
noCursorTimeout - true if the cursor timeout should be turned off.public boolean isPartial()
public FindOperation<T> partial(boolean partial)
partial - allow partial results from a mongos if some shards are downpublic ReadConcern getReadConcern()
public FindOperation<T> readConcern(ReadConcern readConcern)
readConcern - the read concernpublic Collation getCollation()
public FindOperation<T> collation(Collation collation)
A null value represents the server default.
collation - the collation options to usepublic BatchCursor<T> execute(ReadBinding binding)
ReadOperationexecute in interface ReadOperation<BatchCursor<T>>binding - the binding to execute in the context ofpublic void executeAsync(AsyncReadBinding binding, SingleResultCallback<AsyncBatchCursor<T>> callback)
AsyncReadOperationexecuteAsync in interface AsyncReadOperation<AsyncBatchCursor<T>>binding - the binding to execute in the context ofcallback - the callback to be called when the operation has been executedpublic ReadOperation<BsonDocument> asExplainableOperation(ExplainVerbosity explainVerbosity)
explainVerbosity - the explain verbositypublic AsyncReadOperation<BsonDocument> asExplainableOperationAsync(ExplainVerbosity explainVerbosity)
explainVerbosity - the explain verbosity