Python error:DeprecationWarning: count is deprecated. Use Collection.count_documents instead.

DeprecationWarning: count is deprecated. Use Collection.count_documents instead.
 
How to avoid this error?
 
def get_registered_user():
users = collection_users.find({'regDate': regDate}).count()
pprint.pprint("users:" + str(users))
You already invited:

Amos

Upvotes from:

count is the old method,you can try another method.

Yulian Cheng - hello

Upvotes from:

You can get things correct as following..
def get_registered_user(): 
users = collection_users.count_documents({'regDate': regDate})
pprint.pprint("users:" + str(users))

If you wanna answer this question please Login or Register