Browse Source

URL support for MongoDB backend. Closes #1299

Ask Solem 11 years ago
parent
commit
fbe256b6e7
2 changed files with 4 additions and 15 deletions
  1. 3 0
      celery/backends/mongodb.py
  2. 1 15
      docs/configuration.rst

+ 3 - 0
celery/backends/mongodb.py

@@ -87,6 +87,9 @@ class MongoBackend(BaseBackend):
                 'taskmeta_collection', self.mongodb_taskmeta_collection)
             self.mongodb_max_pool_size = config.get(
                 'max_pool_size', self.mongodb_max_pool_size)
+        if url:
+            # Specifying backend as an URL
+            self.mongodb_host = url
 
         self._connection = None
 

+ 1 - 15
docs/configuration.rst

@@ -499,18 +499,6 @@ CELERY_MONGODB_BACKEND_SETTINGS
 
 This is a dict supporting the following keys:
 
-* host
-    Host name of the MongoDB server. Defaults to ``localhost``.
-
-* port
-    The port the MongoDB server is listening to. Defaults to 27017.
-
-* user
-    User name to authenticate to the MongoDB server as (optional).
-
-* password
-    Password to authenticate to the MongoDB server (optional).
-
 * database
     The database name to connect to. Defaults to ``celery``.
 
@@ -538,10 +526,8 @@ Example configuration
 
 .. code-block:: python
 
-    CELERY_RESULT_BACKEND = 'mongodb'
+    CELERY_RESULT_BACKEND = 'mongodb://192.168.1.100:30000/'
     CELERY_MONGODB_BACKEND_SETTINGS = {
-        'host': '192.168.1.100',
-        'port': 30000,
         'database': 'mydb',
         'taskmeta_collection': 'my_taskmeta_collection',
     }