API reference

Component

class asphalt.mongodb.MongoDBComponent(*, client_args=None, resource_name='default')

Bases: Component

Creates an AsyncIOMotorClient resource.

The client will not connect to the target database until it’s used for the first time.

Parameters:
async start(ctx)

Perform any necessary tasks to start the services provided by this component.

In this method, components typically use the context to:

It is advisable for Components to first add all the resources they can to the context before requesting any from it. This will speed up the dependency resolution and prevent deadlocks.

Parameters:

ctx – the containing context for this component