How to find names of all collections using PyMongo?

To find the collections, you can use collection_names() – https://pymongo.readthedocs.io/en/stable/api/pymongo/database.html#pymongo.database.Database.collection_names

Update:

The collection_names is deprecated from 3.7 onwards and been replaced by list_collection_names() – https://pymongo.readthedocs.io/en/stable/api/pymongo/database.html#pymongo.database.Database.list_collection_names

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)