what is correct way of adding a user in admin with role userAdminAnyDatabase doing upgrade to 2.6 I am running a mongodb 2.4 with auth enabled  and want to upgrade to 2.6 

Instructions in upgrade 2.6 says:


  Before beginning the upgrade process for a deployment that uses authentication and authorization:
  
  
  Ensure that at least one user exists in the admin database with the role userAdminAnyDatabase.
  then upgrade binaries
  then run athorization schema format if needed
  


So I have to add user with the role userAdminAnyDatabase in 2.4  before copies binaries of 2.6 ?

in current 2.4 shell added user with role userAdminAnyDatabase and then schema upgrade with userAdminAnyDatabase role after coping binaries of 2.6

db.addUser( { user: "a", pwd: "pass", roles: [ "userAdminAnyDatabase" ] } )


Is this the right way? Do i need to add read write access as well?  

I think i might not get the error below if I go into admin database with role userAdminAnyDatabase

&gt; show collections
2016-02-22T18:51:10.765-0500 error: {
  "$err" : "not authorized for query on oasis.system.namespaces",
  "code" : 13
} at src/mongo/shell/query.js:131
IMPORTANT 
  The userAdminAnyDatabase user can grant itself and any other
  user full access to the entire MongoDB instance. The credentials to
  log in as this user should be carefully controlled.
  
  Users with the userAdmin and userAdminAnyDatabase privileges are not
  the same as the UNIX root superuser in that this role confers no
  additional access beyond user administration. These users cannot
  perform administrative operations or read or write data without first
  conferring themselves with additional permissions.


4 Steps for upgrading MongoDB v2.4 to v2.6


Ensure that at least one user exists in the admin database with the role userAdminAnyDatabase.
Upgrade client libraries,compatible with v2.6
Upgrade all MongoDB process to 2.6
Connect and authenticate to the mongod instance for a single deployment or a mongos for a sharded cluster as an admin database user with the role userAdminAnyDatabase.Use the authSchemaUpgrade command in the admin database to update the user data using the mongo shell.


See Also:

Upgrade MongoDB to 2.6
https://docs.mongodb.org/v2.6/release-notes/2.6-upgrade/

Create a User Administrator
https://docs.mongodb.org/v2.4/tutorial/add-user-administrator/