title: How I can create user defined roles in mongoDB
body: <p>I have a database in mongoDB 2.6.4 in which I want to restrict the user as per their level.I want to given read privileges to some user and insert/update privileges to some user on a particular database.Please let me know how I can create user defined roles and assign it to the user.I tried the below but it is not working user have still full privileges.</p>
  
  <pre><code>db.runCommand({createRole: "read",
                 privileges: [
                     { resource: { db: "sample", collection: "" }, 
                       actions: [ "find" ] 
                     }],
                 roles: [],
                 writeConcern: { w: "majority" , wtimeout: 5000 }
               })
  </code></pre>
  
  <p>==================================================================================</p>
  
  <pre><code>db.addUser( { user : "read",
                pwd  : "read",
                roles:["read"]
          } )
  </code></pre>