Package com.mongodb.client
Interface MongoCursor<TResult>
- 
- Type Parameters:
 TResult- The type of documents the cursor contains
- All Superinterfaces:
 java.lang.AutoCloseable,java.io.Closeable,java.util.Iterator<TResult>
- All Known Subinterfaces:
 MongoChangeStreamCursor<TResult>
@NotThreadSafe @Deprecated(since="2021-05-27") public interface MongoCursor<TResult> extends java.util.Iterator<TResult>, java.io.Closeable
Deprecated.Usage of this API is not supported in AEM as a Cloud Service.The Mongo Cursor interface implementing the iterator protocol.An application should ensure that a cursor is closed in all circumstances, e.g. using a try-with-resources statement:
try (MongoCursor<Document> cursor = collection.find().iterator()) { while (cursor.hasNext()) { System.out.println(cursor.next()); } }- Since:
 - 3.0
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated.ServerAddressgetServerAddress()Deprecated.Returns the server addressServerCursorgetServerCursor()Deprecated.Returns the server cursor, which can be null if the no cursor was created or if the cursor has been exhausted or killed.booleanhasNext()Deprecated.TResultnext()Deprecated.TResulttryNext()Deprecated.A specialnext()case that returns the next element in the iteration if available or null. 
 - 
 
- 
- 
Method Detail
- 
close
void close()
Deprecated.- Specified by:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable
 
- 
hasNext
boolean hasNext()
Deprecated.- Specified by:
 hasNextin interfacejava.util.Iterator<TResult>
 
- 
tryNext
@Nullable TResult tryNext()
Deprecated.A specialnext()case that returns the next element in the iteration 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 element if a document had been added to the capped collection.- Returns:
 - the next element in the iteration if available or null.
 
 
- 
getServerCursor
@Nullable ServerCursor getServerCursor()
Deprecated.Returns the server cursor, which can be null if the no cursor was created or if the cursor has been exhausted or killed.- Returns:
 - the ServerCursor, which can be null.
 
 
- 
getServerAddress
ServerAddress getServerAddress()
Deprecated.Returns the server address- Returns:
 - ServerAddress
 
 
 - 
 
 -