Home > OS >  Count collections on database mongoDB
Count collections on database mongoDB

Time:09-28

How can I know how many collections exists in a database in mongoDB in mongoshell (mongosh)

The only thing I have is db.getCollectionNames() but I can't count the lenght ot that array.

CodePudding user response:

As far as I know you can use db.getCollectionNames().length

  • Related