Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB shell getCollectionNames not working properly

When in mongo shell 3.x I found this strange behaviour:

  • Typing db.getCollectionNames() i get [] but I know that there are collections
  • Typing db.myColl.findOne() in fact it returns a document as I expect

Does anyone know why? Thanks

like image 407
Giovanni Alluvatti Avatar asked Oct 19 '22 07:10

Giovanni Alluvatti


1 Answers

You're already on 3.x. so this shouldn't have any impact i take ?

docs.mongodb.com/manual/reference/method/db.getCollectionNames as the link says it returns empty array for shell lower than 3.X

like image 182
KaSh Avatar answered Jan 04 '23 06:01

KaSh