Pymongo>3.7 deprecates collection_names in favour of list_collection_names
(db, include_system_collections=False)
| 68 | |
| 69 | |
| 70 | def list_collection_names(db, include_system_collections=False): |
| 71 | """Pymongo>3.7 deprecates collection_names in favour of list_collection_names""" |
| 72 | if PYMONGO_VERSION >= (3, 7): |
| 73 | collections = db.list_collection_names() |
| 74 | else: |
| 75 | collections = db.collection_names() |
| 76 | |
| 77 | if not include_system_collections: |
| 78 | collections = [c for c in collections if not c.startswith("system.")] |
| 79 | |
| 80 | return collections |
no outgoing calls
searching dependent graphs…