Use authsource instead of auth_source for compatibilities with pymongo
This commit is contained in:
committed by
Alex Dusenbery
parent
09031dc250
commit
ae0c051e9e
@@ -28,7 +28,7 @@ class MongoBackend(BaseBackend):
|
||||
- `password`: collection user password
|
||||
- `database`: name of the database
|
||||
- `collection`: name of the collection
|
||||
- 'auth_source': name of the authentication database
|
||||
- 'authsource': name of the authentication database
|
||||
- `extra`: parameters to pymongo.MongoClient not listed above
|
||||
|
||||
"""
|
||||
@@ -46,7 +46,7 @@ class MongoBackend(BaseBackend):
|
||||
db_name = kwargs.get('database', 'track')
|
||||
collection_name = kwargs.get('collection', 'events')
|
||||
|
||||
auth_source = kwargs.get('auth_source') or None
|
||||
auth_source = kwargs.get('authsource') or None
|
||||
|
||||
# Other mongo connection arguments
|
||||
extra = kwargs.get('extra', {})
|
||||
|
||||
@@ -46,7 +46,7 @@ def connect_to_mongodb(
|
||||
mongo_client_class = pymongo.MongoClient
|
||||
|
||||
# If the MongoDB server uses a separate authentication database that should be specified here
|
||||
auth_source = kwargs.pop('auth_source', '') or None
|
||||
auth_source = kwargs.get('authsource', '') or None
|
||||
|
||||
# If read_preference is given as a name of a valid ReadPreference.<NAME>
|
||||
# constant such as "SECONDARY_PREFERRED" or a mongo mode such as
|
||||
|
||||
Reference in New Issue
Block a user