Home:ALL Converter>How to query get collections like in pymongo (javascript)

How to query get collections like in pymongo (javascript)

Ask Time:2017-04-11T00:56:36         Author:Shivankar

Json Formatter

From Mongo console I can use Javascript to get collections like,by using the following function db.getCollectionNames().forEach(function(d){if(d.match(/_test$/)){print (d);}}) which gives all collections whose name end with test.

How can I do the same via python i.e pymongo

Author:Shivankar,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/43328934/how-to-query-get-collections-like-in-pymongo-javascript
yy