Можете да направите...
JavaScript (обвивка):
db.getCollectionNames()
Node.js:
db.listCollections()
Не-JavaScript (само черупка):
show collections
Причината да наричам това не-JavaScript е, защото:
$ mongo prodmongo/app --eval "show collections"
MongoDB shell version: 3.2.10
connecting to: prodmongo/app
2016-10-26T19:34:34.886-0400 E QUERY [thread1] SyntaxError: missing ; before statement @(shell eval):1:5
$ mongo prodmongo/app --eval "db.getCollectionNames()"
MongoDB shell version: 3.2.10
connecting to: prodmongo/app
[
"Profiles",
"Unit_Info"
]
Ако наистина искате тези сладки, сладки show collections
извеждане, можете да:
$ mongo prodmongo/app --eval "db.getCollectionNames().join('\n')"
MongoDB shell version: 3.2.10
connecting to: prodmongo/app
Profiles
Unit_Info