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

Opening 2.6 DB with 2.4 creates unique index on admin.system.users

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.6.0-rc0
    • 2.5.4
    • Security
    • Fully Compatible
    • ALL
    • Hide

      > use admin
      > db.system.users.find()
      > db.createUser({user:"user",pwd:"pwd",roles:[]})
      Successfully added user: { "user" : "user", "roles" : [ ] }
      > use test
      switched to db test
      > db.createUser({user:"user",pwd:"pwd",roles:[]})
      2014-01-28T14:21:51.423-0500 Error: couldn't add user: User "user@test" already exists at src/mongo/shell/db.js:1004

      Show
      > use admin > db.system.users.find() > db.createUser({user:"user",pwd:"pwd",roles:[]}) Successfully added user: { "user" : "user", "roles" : [ ] } > use test switched to db test > db.createUser({user:"user",pwd:"pwd",roles:[]}) 2014-01-28T14:21:51.423-0500 Error: couldn't add user: User "user@test" already exists at src/mongo/shell/db.js:1004

    Description

      Opening a 2.6 DB with 2.4 creates a unique index on the admin.system.users collection that prevents adding multiple users with the same name to different DBs when reopening in 2.6.

      { "v" : 1, "key" : { "user" : 1, "userSource" : 1 }, "unique" : true, "ns" : "admin.system.users", "name" : "user_1_userSource_1" }

      This could be fixed by automatically deleting such an index if the user doc version is >= 3.

      Attachments

        Activity

          People

            spencer@mongodb.com Spencer Brody (Inactive)
            andreas.nilsson Andreas Nilsson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: