mongoengine will error on pymongo 3.7.0

Created on 28 Jun 2018  路  5Comments  路  Source: MongoEngine/mongoengine

mongoengine will error on pymongo 3.7.0

url = "mongodb://xxx:xxx@xxxx:xxx/data"
connect(alias="data", host=url)

count = len(ToDo.objects) 
Traceback (most recent call last):
  File "test.py", line 26, in <module>
    count = len(ToDo.objects)
  File "/Users/xxxx/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python3.5/site-packages/mongoengine/queryset/manager.py", line 37, in __get__
    queryset = queryset_class(owner, owner._get_collection())
  File "/Users/xxxx/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python3.5/site-packages/mongoengine/document.py", line 190, in _get_collection
    db = cls._get_db()
  File "/Users/xxxx/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python3.5/site-packages/mongoengine/document.py", line 179, in _get_db
    return get_db(cls._meta.get('db_alias', DEFAULT_CONNECTION_NAME))
  File "/Users/xxxx/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python3.5/site-packages/mongoengine/connection.py", line 235, in get_db
    db.authenticate(conn_settings['username'], conn_settings['password'], **auth_kwargs)
  File "/Users/xxxx/Library/Python/3.5/lib/python/site-packages/pymongo/database.py", line 1274, in authenticate
    connect=True)
  File "/Users/xxxx/Library/Python/3.5/lib/python/site-packages/pymongo/mongo_client.py", line 604, in _cache_credentials
    raise OperationFailure('Another user is already authenticated '
pymongo.errors.OperationFailure: Another user is already authenticated to this database. You must logout first.

if use pymongo 3.6.1 is ok

Most helpful comment

Same here, the way we overcome this were set a fixed version for pymongo in the pip requirements.

pymongo==3.6.1

All 5 comments

Obviously same problem here as #1814 , just heads up @erdenezul @wojcikstefan

Yep - reporting this same issue.

Same here, the way we overcome this were set a fixed version for pymongo in the pip requirements.

pymongo==3.6.1

Mongodb will be fixing this through the driver in https://jira.mongodb.org/browse/PYTHON-1609 . They have the fix in a v3.7 branch. Not sure when they will merge it.

pymongo 3.7.1 should fix this issue:

http://api.mongodb.com/python/current/changelog.html#changes-in-version-3-7-1

Was this page helpful?
0 / 5 - 0 ratings