Package com.mongodb
Interface Cursor
- All Superinterfaces:
- AutoCloseable,- Closeable,- Iterator<DBObject>
- All Known Implementing Classes:
- DBCursor
Interface for providing consistent behaviour between different Cursor implementations.
- Since:
- 2.12
- MongoDB documentation
- Cursors
- 
Method SummaryModifier and TypeMethodDescriptionintGets the number of results available locally without blocking, which may be 0.voidclose()Terminates this cursor on the server.longGets the server's identifier for this Cursor.Gets the address of the server that data is pulled from.Methods inherited from interface java.util.IteratorforEachRemaining, hasNext, next, remove
- 
Method Details- 
availableint available()Gets the number of results available locally without blocking, which may be 0.If the cursor is known to be exhausted, returns 0. If the cursor is closed before it's been exhausted, it may return a non-zero value. - Returns:
- the number of results available locally without blocking
- Since:
- 4.5
 
- 
getCursorIdlong getCursorId()Gets the server's identifier for this Cursor.- Returns:
- the cursor's ID, or 0 if there is no active cursor.
 
- 
getServerAddressGets 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, or null if a cursor is no longer established
 
- 
closevoid close()Terminates this cursor on the server.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 
-