reactivemongo

api

package api

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. api
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait AuthenticationMode extends AnyRef

    Then mode of authentication against the replica set.

  2. trait Collection extends AnyRef

    A MongoDB Collection.

    A MongoDB Collection. You should consider the default BSON implementation.

    Example using the default implementation:

    import reactivemongo.bson._
    import reactivemongo.api.collections.bson.BSONCollection
    
    object Samples {
    
      val connection = MongoConnection(List("localhost"))
    
      // Gets a reference to the database "plugin"
      val db = connection("plugin")
    
      // Gets a reference to the collection "acoll"
      // By default, you get a BSONCollection.
      val collection = db[BSONCollection]("acoll")
    
      def listDocs() = {
        // Select only the documents which field 'firstName' equals 'Jack'
        val query = BSONDocument("firstName" -> "Jack")
        // select only the field 'lastName'
        val filter = BSONDocument(
          "lastName" -> 1,
          "_id" -> 0)
    
        // Get a cursor of BSONDocuments
        val cursor = collection.find(query, filter).cursor[BSONDocument]
        // Let's enumerate this cursor and print a readable representation of each document in the response
        cursor.enumerate().apply(Iteratee.foreach { doc =>
          println("found document: " + BSONDocument.pretty(doc))
        })
    
        // Or, the same with getting a list
        val cursor2 = collection.find(query, filter).cursor[BSONDocument]
        val futureList = cursor.collect[List]()
        futureList.map { list =>
          list.foreach { doc =>
            println("found document: " + BSONDocument.pretty(doc))
          }
        }
      }
    }
  3. trait CollectionMetaCommands extends AnyRef

    A mixin that provides commands about this Collection itself.

  4. 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.

  5. trait Cursor[T] extends AnyRef

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

    Flattening strategy for cursor.

  7. trait CursorProducer[T] extends AnyRef

    Allows to enrich a base cursor.

  8. trait DB extends AnyRef

    A Mongo Database.

    A Mongo Database.

    Example:

    import reactivemongo.api._
    
    val connection = MongoConnection( List( "localhost:27016" ) )
    val db = connection("plugin")
    val collection = db("acoll")
    
    // more explicit way
    val db2 = connection.db("plugin")
    val collection2 = db2.collection("plugin")
  9. trait DBMetaCommands extends AnyRef

    A mixin that provides commands about this database itself.

  10. case class DefaultDB(name: String, connection: MongoConnection, failoverStrategy: FailoverStrategy = FailoverStrategy()) extends DB with DBMetaCommands with GenericDB[BSONSerializationPack.type] with Product with Serializable

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

  11. 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.

  12. class Failover2[A] extends AnyRef

  13. case class FailoverStrategy(initialDelay: FiniteDuration = 500 milliseconds, retries: Int = 5, delayFactor: (Int) ⇒ Double = n => 1) extends Product with Serializable

    A failover strategy for sending requests.

    A failover strategy for sending requests.

    initialDelay

    the initial delay between the first failed attempt and the next one.

    retries

    the number of retries to do before giving up.

    delayFactor

    a function that takes the current iteration and returns a factor to be applied to the initialDelay.

  14. class FlattenedCursor[T] extends Cursor[T]

  15. trait GenericDB[P <: SerializationPack with Singleton] extends AnyRef

  16. class MongoConnection extends AnyRef

    A Mongo Connection.

    A Mongo Connection.

    This is a wrapper around a reference to a reactivemongo.core.actors.MongoDBSystem Actor. 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 reactivemongo.api._
    
    val connection = MongoConnection( List( "localhost" ) )
    val db = connection("plugin")
    val collection = db("acoll")
    
    // more explicit way
    val db2 = connection.db("plugin")
    val collection2 = db2.collection("plugin")
  17. case class MongoConnectionOptions(connectTimeoutMS: Int = 0, authSource: Option[String] = None, sslEnabled: Boolean = false, sslAllowsInvalidCert: Boolean = false, authMode: AuthenticationMode = CrAuthentication, tcpNoDelay: Boolean = false, keepAlive: Boolean = false, nbChannelsPerNode: Int = 10, writeConcern: WriteConcern = WriteConcern.Default, readPreference: ReadPreference = ReadPreference.primary) extends Product with Serializable

    Options for MongoConnection.

    Options for MongoConnection.

    connectTimeoutMS

    The number of milliseconds to wait for a connection to be established before giving up.

    authSource

    The database source for authentication credentials.

    sslEnabled

    Enable SSL connection (required to be accepted on server-side).

    sslAllowsInvalidCert

    If sslEnabled is true, this one indicates whether to accept invalid certificates (e.g. self-signed).

    authMode

    Either CrAuthentication or ScramSha1Authentication

    tcpNoDelay

    TCPNoDelay flag (ReactiveMongo-specific option). The default value is false (see TCP_NODELAY).

    keepAlive

    TCP KeepAlive flag (ReactiveMongo-specific option). The default value is false (see SO_KEEPALIVE).

    nbChannelsPerNode

    Number of channels (connections) per node (ReactiveMongo-specific option).

    writeConcern

    the default write concern

    readPreference

    the default read preference

  18. class MongoDriver extends AnyRef

  19. case class QueryOpts(skipN: Int = 0, batchSizeN: Int = 0, flagsN: Int = 0) extends 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.

    flagsN

    The query flags.

  20. sealed trait ReadPreference extends AnyRef

    MongoDB Read Preferences enable to read from primary or secondaries with a predefined strategy.

  21. trait SerializationPack extends AnyRef

  22. type SerializationPackObject = SerializationPack with Singleton

  23. trait WrappedCursor[T] extends Cursor[T]

    Cursor wrapper, to help to define custom cursor classes.

    Cursor wrapper, to help to define custom cursor classes.

    See also

    CursorProducer

Value Members

  1. object BSONSerializationPack extends SerializationPack

    The default serialization pack.

  2. object CrAuthentication extends AuthenticationMode with Product with Serializable

    MongoDB-CR authentication

  3. object Cursor

  4. object CursorFlattener

    Flatteners helper

  5. object CursorProducer

  6. object DB

  7. object DefaultCursor

  8. object Failover

  9. object Failover2

  10. object MongoConnection

  11. object MongoDriver

  12. object ReadPreference

  13. object ScramSha1Authentication extends AuthenticationMode with Product with Serializable

    SCRAM-SHA-1 authentication (see MongoDB 3.0)

  14. package collections

  15. package commands

  16. package gridfs

  17. package indexes

Inherited from AnyRef

Inherited from Any

Ungrouped