-2

I'm new to using Mongo, so sorry if this is basic. When I run "show collections" I only get partial results. I'm trying to figure out the best way to add the missing collections.

Any help is greatly appreciated.

Andrew L
  • 11
  • 1
  • 2
    Basic questions are fine, but you do need to add enough detail to make it an answerable question. What collections are missing? Are you sure you're looking in the right database? – JohnnyHK Jan 20 '16 at 14:42
  • What do you get if you run `show dbs` ? Are the missing collections in any of the other databases. – Alex Jan 20 '16 at 14:48
  • 1
    Another bit of advice, after posting a question, stick around for a while in case people need clarification. :-) – JohnnyHK Jan 20 '16 at 15:07
  • Thanks. Yes, I'm using the right db. I can see/reference the collections in this db through Heroku's app and in the code base. I have ~20 collections in the db, but only four show up when I run "show collections". So the questions is how do I get at least the one collection I need to show from shell... I wasn't sure if I needed to use another command to add it in... – Andrew L Jan 21 '16 at 14:05

1 Answers1

0

Try calling db.getCollectionNames().join(). It's possible your shell window is not displaying the output of show collections correctly. The join() method will print all the elements of the collections array in a single (word-wrapped) line. Perhaps this difference in display will yield the missing collections.

This answer suggests you can use db.listCollections() on version 2.x or higher.

Community
  • 1
  • 1
Owain Williams
  • 2,387
  • 17
  • 22
  • Thanks for your help Owain. sadly, I get the same results when I use the db.getCollectionNames().join() command.. – Andrew L Jan 21 '16 at 14:07