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?
Make sure you have selected a database: use <database>
.
If it still does not work, try show collections
.