Collects all the documents into a collection of type M[T]
.
Collects all the documents into a collection of type M[T]
.
the maximum number of documents to be retrieved (-1 for unlimited).
The binary operator to be applied when failing to get the next response. Exception or Fail raised within the suc
function cannot be recovered by this error handler.
import scala.concurrent.ExecutionContext import reactivemongo.api.Cursor import reactivemongo.api.bson.BSONDocument import reactivemongo.api.bson.collection.BSONCollection def foo(collection: BSONCollection, query: BSONDocument)( implicit ec: ExecutionContext) = { val cursor = collection.find(query).cursor[BSONDocument]() // return the 3 first documents in a Vector[BSONDocument]. cursor.collect[Vector](3, Cursor.FailOnError[Vector[BSONDocument]]()) }
Cursor over results from MongoDB.
the type parsed from each result document