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 .
Ref:
Implementation of List Command
return;
}
LOGV2_DEBUG(22546, 1, "Reloading view catalog for database", logAttrs(dbName));
uncommittedCatalogUpdates.replaceViewsForDatabase(dbName,
loadViewsForDatabase(opCtx, *this, dbName));
PublishCatalogUpdates::ensureRegisteredWithRecoveryUnit(opCtx, uncommittedCatalogUpdates);
}
const Collection* CollectionCatalog::establishConsistentCollection(
OperationContext* opCtx,
const NamespaceStringOrUUID& nssOrUUID,
boost::optional<Timestamp> readTimestamp) const {
if (_needsOpenCollection(opCtx, nssOrUUID, readTimestamp)) {
auto coll = _openCollection(opCtx, nssOrUUID, readTimestamp);
// Usually, CappedSnapshots must be established before opening the storage snapshot. Thus,
// the lookup must be done from the in-memory catalog. It is possible that the required
// CappedSnapshot was not properly established when this operation was collection creation,
// because a Collection instance was not found in the in-memory catalog.