Package com.mongodb
Interface Cursor
-
- All Superinterfaces:
AutoCloseable,Closeable,Iterator<com.mongodb.DBObject>
- All Known Implementing Classes:
DBCursor
public interface Cursor extends Iterator<com.mongodb.DBObject>, Closeable
Interface for providing consistent behaviour between different Cursor implementations.- Since:
- 2.12
- MongoDB documentation
- Cursors
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Terminates this cursor on the server.longgetCursorId()Gets the server's identifier for this Cursor.com.mongodb.ServerAddressgetServerAddress()Gets the address of the server that data is pulled from.-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
-
-
-
Method Detail
-
getCursorId
long getCursorId()
Gets the server's identifier for this Cursor.- Returns:
- the cursor's ID, or 0 if there is no active cursor.
-
getServerAddress
com.mongodb.ServerAddress getServerAddress()
Gets the address of the server that data is pulled from. Note that this information may not be available until hasNext() or next() is called.- Returns:
- the address of the server that data is pulled from
-
close
void close()
Terminates this cursor on the server.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-