Skip to content

MongoDB driver for Kotlin (coroutines)opensavvy.ktmongo.coroutinesMongoIterabletoSequence

toSequence

open fun toSequence(): <Document>

Deprecated (with error)

Kotlin Sequences are not capable of closing a resource after they are done. Using sequences with a MongoIterable will create memory leaks. Instead, use toList, forEach, asStream (Java only) or the coroutines driver's asFlow

Replace with

<div class="highlight"><pre><code class="md-code__content"><span markdown>this.toList().asSequence()
</span></code></pre></div>