[DOCS-5903] db.createRole() Example uses wrong format Created: 24/Jul/15  Updated: 30/Oct/23  Resolved: 25/Jul/15

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task Priority: Major - P3
Reporter: Dean Johnson Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 8 years, 29 weeks, 4 days ago

 Description   

The example for db.createRole() (http://docs.mongodb.org/manual/reference/method/db.createRole/#example), the write concern should be passed as a document in a separate argument not as part of the role document.

use admin
db.createRole({ role: "myClusterwideAdmin",
  privileges: [
    { resource: { cluster: true }, actions: [ "addShard" ] },
    { resource: { db: "config", collection: "" }, actions: [ "find", "update", "insert", "remove" ] },
    { resource: { db: "users", collection: "usersCollection" }, actions: [ "update", "insert", "remove" ] },
    { resource: { db: "", collection: "" }, actions: [ "find" ] }
  ],
  roles: [
    { role: "read", db: "admin" }
  ],
  writeConcern: { w: "majority" , wtimeout: 5000 }
})

I believe should be...

use admin
db.createRole({ role: "myClusterwideAdmin",
  privileges: [
    { resource: { cluster: true }, actions: [ "addShard" ] },
    { resource: { db: "config", collection: "" }, actions: [ "find", "update", "insert", "remove" ] },
    { resource: { db: "users", collection: "usersCollection" }, actions: [ "update", "insert", "remove" ] },
    { resource: { db: "", collection: "" }, actions: [ "find" ] }
  ],
  roles: [
    { role: "read", db: "admin" }
  ]},
  { w: "majority" , wtimeout: 5000 }
)



 Comments   
Comment by Githook User [ 25/Jul/15 ]

Author:

{u'username': u'kay-kim', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-5902 DOCS-5903 createRole clarifications and fix parameter ordering for user/role methods
Branch: master
https://github.com/mongodb/docs/commit/7acade61f4795c7ed20dbd416eb597d43804d06f

Comment by Githook User [ 25/Jul/15 ]

Author:

{u'username': u'kay-kim', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-5902 DOCS-5903 createRole clarifications and fix parameter ordering for user/role methods
Branch: v2.6
https://github.com/mongodb/docs/commit/15335ec7c918e800752af8a06426431d0eb1acdc

Comment by Dean Johnson [ 24/Jul/15 ]

Thanks for addressing!

Comment by Kay Kim (Inactive) [ 24/Jul/15 ]

You're correct. Will correct as well as incorporate your feedback from the other createRole ticket. Thanks for taking the time to file these tickets.

Regards,

Kay Kim

Generated at Thu Feb 08 07:51:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.