Equivalent to db.getCollectionNames () in pymongo

Command

mongodb db.getCollectionNames() will give you all the collection names that are all in the current database in the list.

I need the same output as pymongo. For a while I searched Google and couldn't find anything like it.

Is there anything similar?

+4
source share
2 answers
  collection_names() 

Show you collections of the current database.

From the documentation:

collection_names()

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

+7
source

Starting with pymongo 3.7, collection_names() deprecated, and the correct way to get collection names is list_collection_names()

0
source

Source: https://habr.com/ru/post/1491059/


All Articles