You can do...
(你可以做...)
JS (shell):
(JS(shell):)
db.getCollectionNames()
node.js:
(Node.js的:)
db.listCollections()
non-JS (shell only):
(非JS(仅限shell):)
show collections
The reason I call that non-JS is because:
(我称之为非JS的原因是:)
$ 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"
]
If you really want that sweet, sweet show collections
output, you can:
(如果你真的想要甜蜜,甜蜜的show collections
输出,你可以:)
$ mongo prodmongo/app --eval "db.getCollectionNames().join('
')"
MongoDB shell version: 3.2.10
connecting to: prodmongo/app
Profiles
Unit_Info
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…