-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Python Drivers
-
Needed
-
The 4.0 migration guide for list_collection_names with include_system_collections is incorrect:
Code like this:: names = client.collection_names() non_system_names = client.collection_names(include_system_collections=False) can be changed to this:: names = client.list_collection_names() non_system_names = client.list_collection_names(filter={"name": {"$regex": r"^(?!system\\.)"}})
Running the above shows it does not actually filter out system collections:
>>> client.db.list_collection_names(filter={"name": {"$regex": r"^(?!system\\.)"}}) ['coll', 'system.views', 'time', 'system.buckets.time', 'view']
Also the example is mistakenly calling methods on client when it should be calling them on Database:
>>> client.list_collection_names(filter={"name": {"$regex": r"^(?!system\\.)"}}) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'Database' object is not callable\