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

Adding first admin user to database via localhost works but returns error message

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.0-rc0
    • Affects Version/s: 2.1.2
    • Component/s: Security, Shell
    • Labels:
      None
    • ALL

      2.1 make getLastError require auth, which it didn't in 2.0 and earlier.

      > mkdir tempdb
      > mongod --auth --dbpath tempdb/

      > mongo
      MongoDB shell version: 2.0.1
      connecting to: test
      test[19:11:40]> use admin
      switched to db admin
      admin[19:11:42]> db.addUser("admin","password")
      Mon Nov 7 19:11:52 uncaught exception: getlasterror failed:

      { "errmsg" : "need to login", "ok" : 0 }

      admin[19:11:52]> db.auth('admin','password')
      1
      admin[19:11:58]> db.system.users.find()

      { "_id" : ObjectId("4eb873c7cdae97d7a7bee931"), "user" : "admin", "readOnly" : false, "pwd" : "90f500568434c37b61c8c1ce05fdf3ae" }

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            spencer@mongodb.com Spencer Brody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: