Package

reactivemongo

api

Permalink

package api

Visibility
  1. Public
  2. All

Type Members

  1. class TestCursor[T] extends Cursor[T]

    Permalink

    EXPERIMENTAL: Base class to implement test-only/mocked Cursor.

    EXPERIMENTAL: Base class to implement test-only/mocked Cursor.

    All functions failed future by default, make sure to override the required functions with appropriate results to execute the tests.

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.{ Cursor, TestCursor }
    
    final class MyTestCursor[T](h: T) extends TestCursor[T] {
      override def head(implicit ctx: ExecutionContext): Future[T] =
        Future.successful(h)
    }
    
    val cursor: Cursor[String] = new MyTestCursor("foo")
    
    def foo(implicit ec: ExecutionContext) {
      cursor.headOption // Future.failed by default
    
      cursor.head // Future.successful("foo")
    
      ()
    }

Value Members

  1. package commands

    Permalink

Ungrouped