MongoDB: fixed deprecation warnings

- collection.count() → either counting the result or using count_documents()
- collection.update() → replaced by update_one()
This commit is contained in:
2019-05-28 16:35:28 +02:00
parent 049d71dc77
commit 577bf8b964
3 changed files with 8 additions and 8 deletions

View File

@@ -101,8 +101,8 @@ def insert_or_fetch_user(wh_payload: dict) -> typing.Optional[dict]:
{'auth.provider': 'blender-id', 'auth.user_id': bid_str},
{'email': {'$in': [wh_payload['old_email'], email]}},
]}
db_users = users_coll.find(query)
user_count = db_users.count()
db_users = list(users_coll.find(query))
user_count = len(db_users)
if user_count > 1:
# Now we have to pay the price for finding users in one query; we
# have to prioritise them and return the one we think is most reliable.