Skip to content

Instantly share code, notes, and snippets.

@sarjarapu
Last active January 15, 2019 07:50
Show Gist options
  • Save sarjarapu/36add7806445dd9dc7adbffedb9bbcef to your computer and use it in GitHub Desktop.
Save sarjarapu/36add7806445dd9dc7adbffedb9bbcef to your computer and use it in GitHub Desktop.
The MongoDB getRole command to show all the granted actions for readWrite role
// command to get readWrite privileges
db.getRole( "readWrite", { showPrivileges: true } ).privileges[0].actions
// output of above command
/*
[
"changeStream",
"collStats",
"convertToCapped",
"createCollection",
"createIndex",
"dbHash",
"dbStats",
"dropCollection",
"dropIndex",
"emptycapped",
"find",
"insert",
"killCursors",
"listCollections",
"listIndexes",
"planCacheRead",
"remove",
"renameCollectionSameDB",
"update"
]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment