MongoDB wrapper: how to search for collections that match name or regex
1 answer
You can use db.getCollectionNames()
with Array.filter()
:
db.getCollectionNames().filter(function (collection) { return /pattern/.test(collection) })
+12
source to share