Return an array of collection names.
Section: Connect and navigate
Get collection names programmatically
javascript
javascript
db.getCollectionNames()Explanation
Convenient when you want a value instead of formatted shell output.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Connect and navigate