From f36337a435c7868876736bb46d08a50e1cbe2df8 Mon Sep 17 00:00:00 2001 From: spengjie Date: Fri, 25 Oct 2019 14:57:32 +0800 Subject: [PATCH] Fix #5734 Celery does not consider authMechanism on mongodb backend URLs --- celery/backends/mongodb.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/celery/backends/mongodb.py b/celery/backends/mongodb.py index dd698007241..8d551bca802 100644 --- a/celery/backends/mongodb.py +++ b/celery/backends/mongodb.py @@ -157,6 +157,10 @@ def _get_connection(self): # don't change self.options conf = dict(self.options) conf['host'] = host + if self.user: + conf['username'] = self.user + if self.password: + conf['password'] = self.password self._connection = MongoClient(**conf)