This document describes the current stable version of Celery (5.4). For development docs, go here.

celery.backends.mongodb

MongoDB result store backend.

class celery.backends.mongodb.MongoBackend(app=None, **kwargs)[source]

MongoDB result backend.

Raises:

celery.exceptions.ImproperlyConfigured – if module https://pypi.org/project/pymongo/ is not available.

as_uri(include_password=False)[source]

Return the backend as an URI.

Parameters:

include_password (bool) – Password censored if disabled.

cleanup()[source]

Delete expired meta-data.

property collection

Get the meta-data task collection.

property database

Get database from MongoDB connection.

performs authentication if necessary.

database_name = 'celery'
decode(data)[source]
encode(data)[source]
property expires_delta
property group_collection

Get the meta-data task collection.

groupmeta_collection = 'celery_groupmeta'
host = 'localhost'
max_pool_size = 10
mongo_host = None
options = None
password = None
port = 27017
supports_autoexpire = False

If true the backend must automatically expire results. The daily backend_cleanup periodic task won’t be triggered in this case.

taskmeta_collection = 'celery_taskmeta'
user = None