package api

Linear Supertypes
PackageCompat, LowPriorityPackage, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. api
  2. PackageCompat
  3. LowPriorityPackage
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. package bson
  2. package collections
  3. package commands
  4. package gridfs
  5. package indexes

Type Members

  1. class AsyncDriver extends Driver

    The asynchronous driver (see MongoConnection).

    The asynchronous driver (see MongoConnection).

    import scala.concurrent.Future
    import reactivemongo.api.{ AsyncDriver, MongoConnection }
    
    val driver = AsyncDriver()
    val connection: Future[MongoConnection] =
      driver.connect("mongodb://node:27017")
  2. sealed trait AuthenticationMode extends AnyRef

    The mode/mechanism of authentication

  3. final class Collation extends AnyRef

    Represents a collection, view, index or operation specific collation.

    Represents a collection, view, index or operation specific collation.

    import reactivemongo.api.Collation
    
    val collation = new Collation(
      locale = "en-US",
      caseLevel = None,
      caseFirst = None,
      strength = Some(Collation.PrimaryStrength),
      numericOrdering = None,
      alternate = None,
      maxVariable = None,
      backwards = None)
  4. trait Collection extends AnyRef

    A MongoDB Collection, resolved from a reactivemongo.api.DefaultDB.

    A MongoDB Collection, resolved from a reactivemongo.api.DefaultDB.

    You should consider the generic API (reactivemongo.api.collections.GenericCollection).

  5. trait CollectionProducer[+C <: Collection] extends AnyRef

    A Producer of Collection implementation.

    A Producer of Collection implementation.

    This is used to get an implementation implicitly when getting a reference of a Collection.

  6. trait Cursor[T] extends CursorCompatAPI[T]

    Cursor over results from MongoDB.

    Cursor over results from MongoDB.

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.Cursor
    import reactivemongo.api.bson.{ BSONDocument, Macros }
    import reactivemongo.api.bson.collection.BSONCollection
    
    case class User(name: String, pass: String)
    
    implicit val handler = Macros.reader[User]
    
    def findUsers(coll: BSONCollection)(
      implicit ec: ExecutionContext): Future[List[User]] =
      coll.find(BSONDocument("enabled" -> true)).
        cursor[User](). // obtain cursor for User results
        collect[List](
          maxDocs = 10,
          err = Cursor.FailOnError[List[User]]())
    T

    the type parsed from each result document

  7. trait CursorCompatAPI[T] extends AnyRef

    Cursor over results from MongoDB.

    Cursor over results from MongoDB.

    T

    the type parsed from each result document

  8. trait CursorFlattener[C[_] <: Cursor[_]] extends AnyRef

    Flattening strategy for cursor.

    Flattening strategy for cursor.

    import scala.concurrent.Future
    
    import reactivemongo.api.{ Cursor, CursorFlattener, FlattenedCursor }
    
    trait FooCursor[T] extends Cursor[T] { def foo: String }
    
    implicit def fooFlattener = new CursorFlattener[FooCursor] {
      def flatten[T](future: Future[FooCursor[T]]): FooCursor[T] =
        new FlattenedCursor[T](future) with FooCursor[T] {
          def foo = "Flattened"
        }
    }
  9. trait CursorOps[T] extends AnyRef

    Internal cursor operations.

  10. final class CursorOptions extends AnyVal

  11. trait CursorProducer[T] extends AnyRef

    Allows to enrich a base cursor.

  12. sealed trait DB extends AnyRef

    The reference to a MongoDB database, obtained from a reactivemongo.api.MongoConnection.

    The reference to a MongoDB database, obtained from a reactivemongo.api.MongoConnection.

    You should consider the provided reactivemongo.api.DefaultDB implementation.

    import scala.concurrent.ExecutionContext
    import reactivemongo.api.MongoConnection
    
    def foo(connection: MongoConnection)(implicit ec: ExecutionContext) = {
      val db = connection.database("plugin")
      val collection = db.map(_("acoll"))
    }
  13. class DefaultDB extends DB with DBMetaCommands with GenericDB[Pack] with Product with Serializable

    The default DB implementation, that mixes in the database traits.

    The default DB implementation, that mixes in the database traits.

    Annotations
    @SerialVersionUID()
  14. class FailoverStrategy extends Product3[FiniteDuration, Int, (Int) => Double] with Serializable

    A failover strategy for sending requests.

    A failover strategy for sending requests. The default uses 10 retries: 125ms, 250ms, 375ms, 500ms, 625ms, 750ms, 875ms, 1s, 1125ms, 1250ms

    import scala.concurrent.duration._
    
    reactivemongo.api.FailoverStrategy(
      initialDelay = 150.milliseconds,
      retries = 20,
      delayFactor = { `try` => `try` * 1.5D })
  15. class FlattenedCursor[T] extends Cursor[T] with FlattenedCursorCompat[T]
  16. class MongoConnection extends AnyRef

    A pool of MongoDB connections, obtained from a reactivemongo.api.MongoDriver.

    A pool of MongoDB connections, obtained from a reactivemongo.api.MongoDriver.

    Connection here does not mean that there is one open channel to the server: behind the scene, many connections (channels) are open on all the available servers in the replica set.

    Example:

    import scala.concurrent.ExecutionContext
    import reactivemongo.api._
    
    def foo(driver: AsyncDriver)(implicit ec: ExecutionContext) = {
      val con = driver.connect(List("localhost"))
      val db = con.flatMap(_.database("plugin"))
      val collection = db.map(_("acoll"))
    }
  17. class MongoConnectionOptions extends Product with Serializable

    Options for MongoConnection (see more documentation).

  18. trait QueryOps extends AnyRef

    Operations about query.

  19. sealed trait ReadConcern extends AnyRef

    The Read Concern allows to control the consistency and isolation used to read data from replica sets.

    The Read Concern allows to control the consistency and isolation used to read data from replica sets.

    import scala.concurrent.ExecutionContext
    
    import reactivemongo.api.ReadConcern
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def queryBuilderWithReadConcern(coll: BSONCollection) =
      coll.find(BSONDocument.empty).
      readConcern(ReadConcern.Available)
  20. sealed trait ReadPreference extends AnyRef

    MongoDB read preference enables to read from primary or secondaries with a predefined strategy.

    MongoDB read preference enables to read from primary or secondaries with a predefined strategy.

    import reactivemongo.api.ReadPreference
    
    val pref: ReadPreference = ReadPreference.primary
  21. trait SerializationPack extends SerializationPackCompat
  22. trait WrappedCursor[T] extends Cursor[T] with WrappedCursorCompat[T]

    Cursor wrapper, to help to define custom cursor classes.

    Cursor wrapper, to help to define custom cursor classes.

    See also

    CursorProducer

  23. trait WrappedCursorOps[T] extends CursorOps[T]

    Internal cursor operations.

  24. sealed trait WriteConcern extends AnyRef

    The write concern.

    The write concern.

    import scala.concurrent.ExecutionContext
    import reactivemongo.api.{ DefaultDB, WriteConcern }
    import reactivemongo.api.bson.BSONDocument
    
    def foo(db: DefaultDB)(implicit ec: ExecutionContext) =
      db.collection("myColl").
        insert(ordered = false, WriteConcern.Acknowledged).
        one(BSONDocument("foo" -> "bar"))

Deprecated Type Members

  1. trait CollectionMetaCommands extends AnyRef

    A mixin that provides commands about this Collection itself.

    A mixin that provides commands about this Collection itself.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.8) Internal: will be made private

  2. trait DBMetaCommands extends AnyRef

    A mixin that provides commands about this database itself.

    A mixin that provides commands about this database itself.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.8) Internal: will be made private

  3. class Failover[T] extends AnyRef

    A helper that sends the given message to the given actor, following a failover strategy.

    A helper that sends the given message to the given actor, following a failover strategy. This helper holds a future reference that is completed with a response, after 1 or more attempts (specified in the given strategy). If the all the tryouts configured by the given strategy were unsuccessful, the future reference is completed with a Throwable.

    Should not be used directly for most use cases.

    T

    Type of the message to send.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.17.0) Unused, will be removed

  4. class MongoDriver extends Driver

    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.4) Use reactivemongo.api.AsyncDriver

  5. case class QueryOpts(skipN: Int = 0, batchSizeN: Int = 0, flagsN: Int = 0) extends QueryOps with Product with Serializable

    A helper to make the query options.

    A helper to make the query options. You may use the methods to set the fields of this class, or set them directly.

    skipN

    the number of documents to skip.

    batchSizeN

    the upper limit on the number of documents to retrieve per batch (0 for unspecified)

    flagsN

    the query flags

    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.8) Internal: will be made private

  6. type SerializationPackObject = SerializationPack with Singleton
    Annotations
    @deprecated
    Deprecated

    (Since version 0.17.0) Unused, will be removed

Value Members

  1. object AsyncDriver

    The driver factory

  2. object ChangeStreams

    Change stream utilities.

    Change stream utilities.

    import scala.concurrent.{ ExecutionContext, Future }
    
    import reactivemongo.api.ChangeStreams.FullDocumentStrategy
    
    import reactivemongo.api.bson.BSONDocument
    import reactivemongo.api.bson.collection.BSONCollection
    
    def peekNext(
      coll: BSONCollection,
      strategy: FullDocumentStrategy)(
      implicit ec: ExecutionContext): Future[Option[BSONDocument]] =
      coll.watch[BSONDocument](fullDocumentStrategy = Some(strategy)).
        cursor.headOption
    
    def doIt(coll: BSONCollection)(
      implicit ec: ExecutionContext): Future[Unit] = for {
        _ <- peekNext(coll, FullDocumentStrategy.Default)
        _ <- peekNext(coll, FullDocumentStrategy.UpdateLookup)
      } yield ()
    See also

    reactivemongo.api.collections.GenericCollection.watch

  3. object Collation

    Collation utilities.

  4. object Cursor

    Cursor companion object

  5. object CursorFlattener

    Flatteners helper

  6. object CursorOps
  7. object CursorOptions
  8. object CursorProducer
  9. object FailoverStrategy extends Serializable

    FailoverStrategy utilities

  10. object MongoConnection
  11. object MongoConnectionOptions extends Serializable

    MongoConnectionOptions factory.

    MongoConnectionOptions factory.

    reactivemongo.api.MongoConnectionOptions(nbChannelsPerNode = 10)
  12. object ReadConcern
  13. object ReadPreference

    ReadPreference utilities and factories.

  14. object ScramSha1Authentication extends AuthenticationMode with ScramAuthentication with Product with Serializable

    SCRAM-SHA-1 authentication (since MongoDB 3.6)

  15. object ScramSha256Authentication extends AuthenticationMode with ScramAuthentication with Product with Serializable

    SCRAM-SHA-256 authentication (see MongoDB 4.0)

  16. object SerializationPack
  17. object Version
  18. object WriteConcern

    WriteConcern utilities.

  19. object X509Authentication extends AuthenticationMode with Product with Serializable

    X509 authentication

Deprecated Value Members

  1. implicit final def toDocument(doc: BSONDocument): BSONDocument
    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.0) Use reactivemongo-bson-api

  2. implicit final def toDocumentHandler[T](implicit h: BSONDocumentHandler[T]): BSONDocumentHandler[T]
    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.0) Use reactivemongo-bson-api or use reactivemongo-bson-compat: import reactivemongo.api.bson.compat._

  3. implicit final def toDocumentReader[T](implicit h: BSONDocumentReader[T]): BSONDocumentReader[T]
    Definition Classes
    LowPriorityPackage
    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.0) Use reactivemongo-bson-api or use reactivemongo-bson-compat: import reactivemongo.api.bson.compat._

  4. implicit final def toDocumentWriter[T](implicit h: BSONDocumentWriter[T]): BSONDocumentWriter[T]
    Definition Classes
    LowPriorityPackage
    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.0) Use reactivemongo-bson-api or use reactivemongo-bson-compat: import reactivemongo.api.bson.compat._

  5. object BSONSerializationPack extends SerializationPack with BSONSerializationPackCompat

    The default serialization pack.

    The default serialization pack.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.0) Will be replaced by reactivemongo.api.bson.collection.BSONSerializationPack

  6. object CrAuthentication extends AuthenticationMode with Product with Serializable

    MongoDB-CR authentication

    MongoDB-CR authentication

    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.4) Use SCRAM or X509

  7. object DB
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Will be removed

  8. object DefaultCursor
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Internal: will be made private

  9. object DefaultDB extends AbstractFunction3[String, MongoConnection, FailoverStrategy, DefaultDB] with Serializable
    Annotations
    @deprecated
    Deprecated

    (Since version 0.16.0) Use DefaultDB class

  10. object Driver

    The driver factory

    The driver factory

    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.4) Internal: will be made private

  11. object Failover2
    Annotations
    @deprecated
    Deprecated

    (Since version 0.17.0) Internal: will be made private

  12. object MongoDriver

    The driver factory

    The driver factory

    Annotations
    @deprecated
    Deprecated

    (Since version 0.19.4) Use reactivemongo.api.AsyncDriver

Inherited from PackageCompat

Inherited from LowPriorityPackage

Inherited from AnyRef

Inherited from Any

Ungrouped