Skip to content

aioworkers/aioworkers-mongo

Repository files navigation

aioworkers-mongo

GitHub Workflow Status PyPI - Python Version PyPI

Mongo plugin for aioworkers.

Usage

Connection

Add this to aioworkers config.yaml:

mongo:
  cls: aioworkers_mongo.base.Connector
  uri: 'mongodb://localhost:27017/'

You can get access to mongo anywhere via context:

docs = [doc async for doc in context.mongo.db.collection.find({})]

Extended client config

mongo:
  cls: aioworkers_mongo.base.Connector
  client:
    host: 'localhost'
    port: 27017

Development

Run Mongo DB:

docker run --rm -p 27017:27017 --name mongo -d mongo

Install dev requirements:

poetry install

Activate env:

. .venv/bin/activate

Run tests:

pytest