MongoCursor

interface MongoCursor<T> : Iterator<T> , Closeable

The Mongo Cursor interface implementing the iterator protocol.

An application should ensure that a cursor is closed in all circumstances, e.g. using a use statement:

collection.find().cursor().use { c ->
while (c.hasNext()) {
println(c.next())
}
}

Parameters

T

The type of documents the cursor contains

Inheritors

Functions

Link copied to clipboard
abstract override fun close()
Link copied to clipboard
open fun forEachRemaining(p0: Consumer<in T>)
Link copied to clipboard
abstract operator fun hasNext(): Boolean
Link copied to clipboard
abstract operator fun next(): T
Link copied to clipboard
abstract fun tryNext(): T?

A special next case that returns the next element in the iteration if available or null.

Properties

Link copied to clipboard
abstract val available: Int

Gets the number of results available locally without blocking, which may be 0.

Link copied to clipboard
abstract val serverAddress: ServerAddress
Link copied to clipboard
abstract val serverCursor: ServerCursor?