In the MongoDB shell, how do I list all collections for the current database that I'm using?
相关问题
- MongoDB can not create unique sparse index (duplic
- Spring Data MongoDB - lazy access to some fields
- Golang mongodb aggregation
- How to convert from Timestamp to Mongo ObjectID
- MongoDB Indexing: Multiple single-field vs single
相关文章
- mongodb有没有什么办法禁止读取数据的时候进行缓存
- mongodb-aggregate聚合查询分组后如何获得多字段
- mongodb error: how do I make sure that your journa
- How to track MongoDB requests from a console appli
- MongoError: cannot infer query fields to set, path
- Pymongo $in Query Not Working
- django.core.exceptions.ImproperlyConfigured: '
- How to represent an array with mixed types
If you want to show all collections from mongodb shell (command line), use shell helper
that show all collections for current database. If you want to get all collection list from your application then you can use mongodb database method
For more info mongodb shell helper you can seee http://docs.mongodb.org/manual/reference/mongo-shell/
this command usually works on mongo shell once you have switched to the database.
I think one of the biggest confusions is the difference between what you can do with
mongo
(or an interactive/hybrid shell) vs.mongo --eval
(or a pure javascript shell). I keep these helpful documents handy:Here is an example of scripting what you might otherwise do with
show
commands:Note: That works really well as a oneliner. (But looks terrible on StackOverflow.)
Details information of every collection
List all collections from the mongo shell :
Try: