Chapter1: count is deprecated. Use Collection.count_documents instead

if you face this error:

/usr/local/lib/python3.7/site-packages/ipykernel_launcher.py:2: DeprecationWarning: count is deprecated. Use Collection.count_documents instead.

after executing:

movies.find( { “cast”: “Salma Hayek” } ).count()

run this instead:

movies.count_documents( { “cast”: “Salma Hayek” } )

1 Like