const classafMongo::ConnectionManagerPooled
sys::Obj afMongo::ConnectionManagerPooled : afMongo::ConnectionManager
Manages a pool of connections.
Connections are created on-demand and kept in a pool when idle.
Note this connection manager is safe for multi-threaded / web-application use.
- connectionUri
const Uri connectionUriThe URI this
ConnectionManagerwas configured with.`mongodb://username:password@example1.com/puppies?maxPoolSize=50`
- defaultDatabase
const Str? defaultDatabaseThe default database connections are authenticated against.
- defaultPassword
const Str? defaultPasswordThe default password connections are authenticated with.
- defaultUsername
const Str? defaultUsernameThe default username connections are authenticated with.
- leaseConnection
virtual override Obj? leaseConnection(|Connection->Obj? c)Makes a connection available to the given function.
All leased connections are authenticated against the default credentials.
- makeFromUri
new makeFromUri(ActorPool actorPool, Uri connectionUri)Create a
ConnectionManagerfrom a Mongo Connection URI. If user credentials are supplied, they are used as default authentication for each connection.The following Uri options are supported:
connectTimeoutMS TODO: socketTimeoutMS TODO: Write Concern Options
URI examples:
`mongodb://username:password@example1.com/database?maxPoolSize=50` `mongodb://example2.com?minPoolSize=10&maxPoolSize=50`
@see http://docs.mongodb.org/manual/reference/connection-string/
- maxPoolSize
const Int maxPoolSize := 10The maximum number of database connections this pool should open. Set it to the number of concurrent users you expect to use your application.
- minPoolSize
const Int minPoolSize := 0The minimum number of database connections this pool should keep open. They are initially created during
startup().- mongoUri
virtual const override Uri mongoUriThe host name of the MongoDB server this
ConnectionManagerconnects to.- shutdown
virtual override ConnectionManager shutdown()Closes all connections.
- startup
virtual override ConnectionManager startup()Creates the initial pool and establishes
minPoolSizeconnections with the server.