Skip to main content

Module for working with MongoDB via asyncpg

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aioworkers-mongo-0.2.1.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

aioworkers_mongo-0.2.1-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page