findAsFlow
Finds documents in a MongoDB collection that match the specified BSON query and returns them as a flow.
Return
A flow of documents that match the specified BSON query.
Example usage:
val collection = // new MongoCollection<Document>
val query = Filters.eq("field", "value")
val resultsFlow = collection.findAsFlow(query)
resultsFlow.collect { document -> println("Found document: $document") }
Content copied to clipboard
Parameters
query
The BSON query to filter the documents.
Finds all documents in a MongoDB collection and returns them as a flow.
Return
A flow of all documents in the collection.
Example usage:
val collection = // new MongoCollection<Document>
val resultsFlow = collection.findAsFlow()
resultsFlow.collect { document -> println("Found document: $document") }
Content copied to clipboard