Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

db.getCollectionNames() equivalent in pymongo

mongodb db.getCollectionNames()command will give you all collection names what are all there in the current db, in a list.

I want the same output using pymongo. I googled some time and couldn't find anything like that.

Is anything like that exists ?

like image 973
John Prawyn Avatar asked Feb 15 '23 22:02

John Prawyn


1 Answers

 collection_names()

Will show you the collections of the current database.

From documentation:

collection_names()

Get a list of all the collection names in this database. [read more]

like image 83
Ionică Bizău Avatar answered Feb 28 '23 12:02

Ionică Bizău