Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-16224

db.getCollectionNames() returns empty array

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.8.0-rc0
    • Component/s: Shell, Usability
    • Labels:
      None
    • ALL
    • Hide

      s571:27017 is running mongodb v2.8.0-rc0

      > /home/admin# mongodb-linux-x86_64-2.8.0-rc0/bin/mongo s571:27017/offerStore 
      MongoDB shell version: 2.8.0-rc0
      connecting to: s571:27017/offerStore
      offerstoreES:SECONDARY> rs.slaveOk()
      offerstoreES:SECONDARY> db.getCollectionNames()
      [
      	"TestCollection",
      	"offer",
      	"offerTimestamp",
      	"profiling",
      	"profiling_mr",
      	"system.indexes",
      	"system.profile",
      	"system.users"
      ]
      

      Test with an older shell fails:

      > /home/admin# mongodb-linux-x86_64-2.6.1/bin/mongo s571:27017/offerStore
      MongoDB shell version: 2.6.1
      connecting to: s571:27017/offerStore
      offerstoreES:SECONDARY> rs.slaveOk()
      offerstoreES:SECONDARY> db.getCollectionNames()
      []
      
      Show
      s571:27017 is running mongodb v2.8.0-rc0 > /home/admin# mongodb-linux-x86_64-2.8.0-rc0/bin/mongo s571:27017/offerStore MongoDB shell version: 2.8.0-rc0 connecting to: s571:27017/offerStore offerstoreES:SECONDARY> rs.slaveOk() offerstoreES:SECONDARY> db.getCollectionNames() [ "TestCollection" , "offer" , "offerTimestamp" , "profiling" , "profiling_mr" , "system.indexes" , "system.profile" , "system.users" ] Test with an older shell fails: > /home/admin# mongodb-linux-x86_64-2.6.1/bin/mongo s571:27017/offerStore MongoDB shell version: 2.6.1 connecting to: s571:27017/offerStore offerstoreES:SECONDARY> rs.slaveOk() offerstoreES:SECONDARY> db.getCollectionNames() []

      Older mongodb shells (here v2.6.1) return an empty array on db.getCollectionNames() issued to a mongodb v2.8.0-rc0

      The v2.8.0-rc0 shell returns correctly the collection names.

      It would be nice if mongodb 2.8.0 returns a result which is compatible for mongodb shells older than 2.8.0, if possible.

      This might also be the reason that the latest pymongo (v2.7.2) driver can't read collection names from mongodb 2.8.0-rc0.
      See also: https://jira.mongodb.org/browse/PYTHON-790

            Assignee:
            Unassigned Unassigned
            Reporter:
            kay.agahd@idealo.de Kay Agahd
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: