title: how to authenticate mongoose connection mongodb in node.js
body: <p>I have created mongodb user with command</p>
  
  <pre><code>use admin
  db.createUser(
      {
        user: "superuser",
        pwd: "12345678",
        roles: [ "root" ]
      }
  )
  </code></pre>
  
  <p>then in my app I am trying to connect mongoose like this</p>
  
  <pre><code>var options = {
  user: "superuser",
  pass: "12345678"
  };
  
  
  var mongooseConnectionString = 'mongodb://localhost/twitter-mongo';
  
  mongoose.connect(mongooseConnectionString,options);
  mongoose.model('User', UserSchema);
  
  var User = mongoose.model('User');
  </code></pre>
  
  <p>I am getting this error when inserting data through mongoose</p>
  
  <pre><code>MongoError: not authorized for insert on twitter-mongo.users
  </code></pre>
  
  <p>please tell me what is wrong in my code</p>