iterator

operator fun <T : Any> MongoIterable<T>.iterator(): MongoCursor<T>

Deprecated

kmongo-dsl: use cursor() (and close it), forEach or toList

Replace with

cursor()

KMongo 4/5 compatibility: the Java driver MongoIterable was an Iterable (for (x in col.find()) compiles) - the Kotlin driver MongoIterable is not.

The returned cursor must be closed if the iteration is not complete: prefer MongoIterable.forEach, MongoIterable.toList or use { } on MongoIterable.cursor.