Search code examples
mongodbshardingmongo-collection

Mongo Get collection names function db.getCollectionNames() is Not working in sharding


I was getting all collection names by function db.getCollectionNames().

But as soon as I started sharding, function db.getCollectionNames() is Not working.

How to get all collection names in database when sharding is active?


Solution

  • Make sure you have selected a database: use <database>.

    If it still does not work, try show collections.