You can either use runCommand or show collection on terminal to list collections on database . This will not have any performance impact , as the information about the collection is pulled from metadata. Usually this metadata information is kept in memory for fast access .
For the sake of argument, what if the collection list had thousands or even tens of thousands of items? Would the query still be lightweight enough, or would it have a noticeable impact on performance?
@Amitoj_Singh1 , run command returns cursor not the entire resultSet. There is a filter option in list Command so that can help to limit your result . As long as you don’t write that in a while loop your good
The anti pattern @steevej mentioned is about having large numbers of collection when you can still optimize to have smaller numbers.