final class AsyncDriver extends AnyRef
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")
- Alphabetic
- By Inheritance
- AsyncDriver
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new AsyncDriver(config: Option[Config] = None, classLoader: Option[ClassLoader] = None)
- config
a custom configuration (otherwise the default options are used)
- classLoader
a classloader used to load the actor system
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from AsyncDriver toany2stringadd[AsyncDriver] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (AsyncDriver, B)
- Implicit
- This member is added by an implicit conversion from AsyncDriver toArrowAssoc[AsyncDriver] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def askConnection(nodes: Seq[String], options: MongoConnectionOptions, name: Option[String]): Future[MongoConnection]
Creates a new MongoConnection.
Creates a new MongoConnection.
- nodes
The list of node names (e.g. node1.foo.com:27017); Port is optional (27017 is used by default)
- options
the options for the new connection pool
- name
the name for the connection pool
- Attributes
- protected
- val classLoader: Option[ClassLoader]
- Attributes
- protected
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def close(timeout: FiniteDuration = FiniteDuration(2, SECONDS))(implicit ec: ExecutionContext): Future[Unit]
Closes this driver (and all its connections and resources).
Closes this driver (and all its connections and resources). Will wait until the timeout for proper closing of connections before forcing hard shutdown.
import scala.concurrent.ExecutionContext def afterClose(drv: reactivemongo.api.AsyncDriver)( implicit ec: ExecutionContext) = drv.close().andThen { case res => println("Close 'Try' result: " + res) }
- val config: Option[Config]
- Attributes
- protected
- def connect[T](parsedURI: URI[T]): Future[MongoConnection]
Creates a new MongoConnection from URI.
Creates a new MongoConnection from URI.
- parsedURI
the URI parsed by reactivemongo.api.MongoConnection.fromString
import scala.concurrent.Future import reactivemongo.api.MongoConnection, MongoConnection.ParsedURI val driver = reactivemongo.api.AsyncDriver() def con(uri: ParsedURI): Future[MongoConnection] = driver.connect(uri) // with automatic name
- def connect[T](parsedURI: URI[T], name: Option[String], strictMode: Boolean): Future[MongoConnection]
Creates a new MongoConnection from URI.
Creates a new MongoConnection from URI.
- parsedURI
The URI parsed by reactivemongo.api.MongoConnection.fromString
- name
the name for the connection pool
- strictMode
the flag to indicate whether the given URI must be a strict one (no ignored/invalid options)
import scala.concurrent.Future import reactivemongo.api.MongoConnection, MongoConnection.ParsedURI val driver = reactivemongo.api.AsyncDriver() def con(uri: ParsedURI): Future[MongoConnection] = driver.connect(uri, name = Some("ConnectionName"))
- def connect[T](parsedURI: URI[T], name: Option[String]): Future[MongoConnection]
Creates a new MongoConnection from URI.
Creates a new MongoConnection from URI.
- parsedURI
The URI parsed by reactivemongo.api.MongoConnection.fromString
- name
the name for the connection pool
import scala.concurrent.Future import reactivemongo.api.MongoConnection, MongoConnection.ParsedURI val driver = reactivemongo.api.AsyncDriver() def con(uri: ParsedURI): Future[MongoConnection] = driver.connect(uri, name = Some("ConnectionName"))
- def connect(uriStrict: String, name: Option[String]): Future[MongoConnection]
Creates a new MongoConnection from URI.
Creates a new MongoConnection from URI.
- uriStrict
the strict URI, that will be parsed by reactivemongo.api.MongoConnection.fromString
- name
the name for the connection pool
import scala.concurrent.Future import reactivemongo.api.MongoConnection val driver = reactivemongo.api.AsyncDriver() val con: Future[MongoConnection] = driver.connect("mongodb://user123:passwd123@host1:27018,host2:27019,host3:27020/somedb?foo=bar&authenticationMechanism=scram-sha1", name = Some("ConnectionName"))
- def connect(uriStrict: String): Future[MongoConnection]
Creates a new MongoConnection from URI.
Creates a new MongoConnection from URI.
- uriStrict
the strict URI, that will be parsed by reactivemongo.api.MongoConnection.fromString
import scala.concurrent.Future import reactivemongo.api.MongoConnection val driver = reactivemongo.api.AsyncDriver() val con: Future[MongoConnection] = driver.connect("mongodb://user123:passwd123@host1:27018,host2:27019,host3:27020/somedb?foo=bar&authenticationMechanism=scram-sha1") // with automatic name
- def connect(nodes: Seq[String], options: MongoConnectionOptions, name: String): Future[MongoConnection]
Creates a new MongoConnection.
Creates a new MongoConnection.
- nodes
The list of node names (e.g. node1.foo.com:27017); Port is optional (27017 is used by default)
- options
the options for the new connection pool
- name
the name for the connection pool
import scala.concurrent.Future import reactivemongo.api.{ MongoConnection, MongoConnectionOptions } val driver = reactivemongo.api.AsyncDriver() val con: Future[MongoConnection] = driver.connect( nodes = Seq("node1:27017", "node2:27017", "node3:27017"), options = MongoConnectionOptions.default.copy(nbChannelsPerNode = 10), name = "ConnectionName")
- def connect(nodes: Seq[String], options: MongoConnectionOptions): Future[MongoConnection]
Creates a new MongoConnection.
Creates a new MongoConnection.
- nodes
The list of node names (e.g. node1.foo.com:27017); Port is optional (27017 is used by default)
- options
the options for the new connection pool
import scala.concurrent.Future import reactivemongo.api.{ MongoConnection, MongoConnectionOptions } val driver = reactivemongo.api.AsyncDriver() val con: Future[MongoConnection] = driver.connect( nodes = Seq("node1:27017", "node2:27017", "node3:27017"), options = MongoConnectionOptions.default.copy(nbChannelsPerNode = 10)) // with automatic name
- def connect(nodes: Seq[String]): Future[MongoConnection]
Creates a new MongoConnection.
Creates a new MongoConnection.
- nodes
The list of node names (e.g. node1.foo.com:27017); Port is optional (27017 is used by default)
import scala.concurrent.Future import reactivemongo.api.MongoConnection val driver = reactivemongo.api.AsyncDriver() val con: Future[MongoConnection] = driver.connect( Seq("node1:27017", "node2:27017", "node3:27017")) // with default options and automatic name
- final val connectionMonitors: Map[ActorRef, MongoConnection]
- Attributes
- protected
- def ensuring(cond: (AsyncDriver) => Boolean, msg: => Any): AsyncDriver
- Implicit
- This member is added by an implicit conversion from AsyncDriver toEnsuring[AsyncDriver] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (AsyncDriver) => Boolean): AsyncDriver
- Implicit
- This member is added by an implicit conversion from AsyncDriver toEnsuring[AsyncDriver] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): AsyncDriver
- Implicit
- This member is added by an implicit conversion from AsyncDriver toEnsuring[AsyncDriver] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): AsyncDriver
- Implicit
- This member is added by an implicit conversion from AsyncDriver toEnsuring[AsyncDriver] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final val supervisorName: String
- Attributes
- protected
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from AsyncDriver toStringFormat[AsyncDriver] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (AsyncDriver, B)
- Implicit
- This member is added by an implicit conversion from AsyncDriver toArrowAssoc[AsyncDriver] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.