aioworkers-mongo

Module for working with MongoDB via asyncpg


Keywords
asyncio, mongo, motor, python
License
Apache-2.0
Install
pip install aioworkers-mongo==0.2.1

Documentation

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