计算数据库中的集合 mongoDB

Count collections on database mongoDB

如何知道在 mongoshell (mongosh)mongoDB 中的数据库中存在多少个集合

我唯一拥有的是 db.getCollectionNames(),但我数不清那个数组的长度。

据我所知你可以使用 db.getCollectionNames().length