how can I get a list of all the collections in the database?
- database – mongodb;
- language – java;
- ide – eclipse;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Getting A List Of Collections
Each database has zero or more collections. You can retrieve a list of them from the db (and print out any that are there) :
Edit : As suggested in @Andrew’s answer, updated java client uses this :
and getting the iterable collection based on the document type :