Hi Please, I appreciate a support to properly migrate the filters used in mongo with the command (getCollectionNames().filter()) in python code. Best thanks
Hi @Mateus_Saldanha,
Perhaps pymongo list_collection_names()
works for you / is what you are after?
Example - Output after connecting to my MongoDB:
>>> print(mongo_db.list_collection_names())
['collection', 'newCollection', 'test_collection']
Regards,
Jason
Thanks Jason for your replay. Please do you know if it’s possible to filter for only one collection, for example, ‘test_’? thanks.
Yes you can use list_collection_names with the filter argument:
>>> client.test.list_collection_names(filter=None)
['test', 'test3']
>>> client.test.list_collection_names(filter={'name': 'test'})
['test']
3 Likes
Great!!! Thank you so much for your replay!!! your comment really helped me. Thanks Shane
Thanks Jason and Shane for share, your comments helped me a lot.
2 Likes
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.