Giovanni Alluvatti
Giovanni Alluvatti

Reputation: 135

MongoDB shell getCollectionNames not working properly

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

Does anyone know why? Thanks

Upvotes: 5

Views: 1916

Answers (2)

Rahul
Rahul

Reputation: 16335

For MongoDB 3.0 deployments using the WiredTiger storage engine, if you run db.getCollectionNames() from a version of the mongo shell before 3.0 or a version of the driver prior to 3.0 compatible version, db.getCollectionNames() will return no data, even if there are existing collections.

FOr more details, refer here

Upvotes: 1

KaSh
KaSh

Reputation: 175

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

Upvotes: 2

Related Questions