Package com.mongodb.operation
Interface BatchCursor<T>
-
- Type Parameters:
T
- The type of documents the cursor contains
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,java.util.Iterator<java.util.List<T>>
- All Known Subinterfaces:
AggregateResponseBatchCursor<T>
,MapReduceBatchCursor<T>
@NotThreadSafe @Deprecated public interface BatchCursor<T> extends java.util.Iterator<java.util.List<T>>, java.io.Closeable
Deprecated.MongoDB returns query results as batches, and this interface provideds an iterator over those batches. The first call to thenext
method will return the first batch, and subsequent calls will trigger a request to get the next batch of results. Clients can control the batch size by setting thebatchSize
property between calls tonext
.- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
close()
Deprecated.int
getBatchSize()
Deprecated.Gets the batch size to use when requesting the next batch.ServerAddress
getServerAddress()
Deprecated.Returns the server addressServerCursor
getServerCursor()
Deprecated.Returns the server cursorboolean
hasNext()
Deprecated.Returns true if another batch of results exists.java.util.List<T>
next()
Deprecated.Returns the next batch of results.void
setBatchSize(int batchSize)
Deprecated.Sets the batch size to use when requesting the next batch.java.util.List<T>
tryNext()
Deprecated.A specialnext()
case that returns the next batch if available or null.
-
-
-
Method Detail
-
close
void close()
Deprecated.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
hasNext
boolean hasNext()
Deprecated.Returns true if another batch of results exists. A tailable cursor will block until another batch exists.- Specified by:
hasNext
in interfacejava.util.Iterator<T>
- Returns:
- true if another batch exists
-
next
java.util.List<T> next()
Deprecated.Returns the next batch of results. A tailable cursor will block until another batch exists.- Specified by:
next
in interfacejava.util.Iterator<T>
- Returns:
- the next batch of results
- Throws:
java.util.NoSuchElementException
- if no next batch exists
-
setBatchSize
void setBatchSize(int batchSize)
Deprecated.Sets the batch size to use when requesting the next batch. This is the number of documents to request in the next batch.- Parameters:
batchSize
- the non-negative batch size. 0 means to use the server default.
-
getBatchSize
int getBatchSize()
Deprecated.Gets the batch size to use when requesting the next batch. This is the number of documents to request in the next batch.- Returns:
- the non-negative batch size. 0 means to use the server default.
-
tryNext
java.util.List<T> tryNext()
Deprecated.A specialnext()
case that returns the next batch if available or null.Tailable cursors are an example where this is useful. A call to
tryNext()
may return null, but in the future callingtryNext()
would return a new batch if a document had been added to the capped collection.- Returns:
- the next batch if available or null.
-
getServerCursor
ServerCursor getServerCursor()
Deprecated.Returns the server cursor- Returns:
- ServerCursor
-
getServerAddress
ServerAddress getServerAddress()
Deprecated.Returns the server address- Returns:
- ServerAddress
-
-