title: How to add authentication to mongodb 2.6?
body: <p>I have existing a test server running mongodb 2.6 on ubuntu. Same version is running on my macbook. In both machines, I upgraded from mongodb 2.4 using standard upgrade mechanisms. Now I need to set up username and password based authentication</p>
  
  <p>On my mac, I updated mongodb to 2.6 using brew update. I </p>
  
  <p>I tried the following command on my Mac</p>
  
  <pre><code>$mongo
  &gt;db.getSiblingDatabase('admin')
  &gt;db.createUser({user:"root", pwd:"mycomplexpassword", roles:[ "userAdminAnyDatabase", "readWrite" ] } )
  </code></pre>
  
  <p>I got the following error</p>
  
  <pre><code>Error: couldn't add user: User and role management commands require auth data to have schema version 3 but found 1 at src/mongo/shell/db.js:1004
  </code></pre>
  
  <p>Hence I am unable enable auth to mongodb. How to solve the issue? Googling for the error does not seem to return anything useful right now.</p>
  
  <p>PS: Should I expect the same issue to appear when I add authentication to mongodb on my servers?</p>