AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

system.roles 자체 관리형 배포의 컬렉션

admin 데이터베이스의 system.roles 컬렉션은 사용자 정의 역할을 저장합니다. MongoDB는 이러한 사용자 정의 역할을 생성하고 관리하기 위해 역할 관리 명령을 제공합니다.

system.roles 컬렉션의 문서에는 다음과 같은 스키마가 있습니다.

{
_id: <system-defined id>,
role: "<role name>",
db: "<database>",
privileges:
[
{
resource: { <resource> },
actions: [ "<action>", ... ]
},
...
],
roles:
[
{ role: "<role name>", db: "<database>" },
...
]
}

system.roles 문서에 다음과 같은 필드가 있습니다.

admin.system.roles.role

The role field is a string that specifies the name of the role.

admin.system.roles.db

The db field is a string that specifies the database to which the role belongs. MongoDB uniquely identifies each role by the pairing of its name (i.e. role) and its database.

admin.system.roles.privileges

The privileges array contains the privilege documents that define the privileges for the role.

권한 문서에는 다음과 같은 구문이 있습니다.

{
resource: { <resource> },
actions: [ "<action>", ... ]
}

각 권한 문서 에는 다음과 같은 필드가 있습니다.

admin.system.roles.privileges[n].resource

A document that specifies the resources upon which the privilege actions apply. The document has one of the following form:

{ db: <database>, collection: <collection> }

or

{ cluster : true }

자세한 내용 은 자체 관리 배포서버에 대한 리소스 문서를 참조하세요.

admin.system.roles.privileges[n].actions

리소스 에 허용된 작업의 배열 . 작업 목록은 권한 작업을 참조하세요.

admin.system.roles.roles

The roles array contains role documents that specify the roles from which this role inherits privileges.

역할 문서에는 다음과 같은 구문이 있습니다.

{ role: "<role name>", db: "<database>" }

역할 문서에는 다음과 같은 필드가 있습니다.

admin.system.roles.roles[n].role

역할 의 이름입니다. 역할 은 MongoDB 내장 제공 역할 또는 사용자 정의 역할 일 수 있습니다.

admin.system.roles.roles[n].db

역할 이 정의된 데이터베이스 의 이름입니다.

admin 데이터베이스 의 system.roles 컬렉션 에 있는 다음 샘플 문서를 살펴보겠습니다.

다음은 myApp 데이터베이스에 대해 정의된 사용자 정의 역할 appUser에 대한 샘플 문서입니다.

{
_id: "myApp.appUser",
role: "appUser",
db: "myApp",
privileges: [
{ resource: { db: "myApp" , collection: "" },
actions: [ "find", "createCollection", "dbStats", "collStats" ] },
{ resource: { db: "myApp", collection: "logs" },
actions: [ "insert" ] },
{ resource: { db: "myApp", collection: "data" },
actions: [ "insert", "update", "remove", "compact" ] },
{ resource: { db: "myApp", collection: "system.js" },
actions: [ "find" ] },
],
roles: []
}

privileges 배열 에는 appUser 역할 이 지정하는 5개의 권한이 나열됩니다.

roles 배열에서 알 수 있듯이 appUser는 다른 역할에서 추가 권한을 상속하지 않습니다.

다음은 myApp 데이터베이스에 정의된 사용자 정의 역할 appAdmin에 대한 샘플 문서입니다. 문서는 appAdmin 역할이 권한을 지정하고 다른 역할로부터 권한을 상속한다는 것을 보여줍니다.

{
_id: "myApp.appAdmin",
role: "appAdmin",
db: "myApp",
privileges: [
{
resource: { db: "myApp", collection: "" },
actions: [ "insert", "dbStats", "collStats", "compact" ]
}
],
roles: [
{ role: "appUser", db: "myApp" }
]
}

privileges 배열은 appAdmin 역할이 지정하는 권한을 나열합니다. 이 역할은 시스템 컬렉션을 제외한 myApp 데이터베이스의 모든 collection에 대한 조치( "insert", "dbStats", "collStats", "compact"를 허용하는 단일 권한을 갖습니다. 데이터베이스를 리소스로 지정을 참조하세요.

roles 배열에는 역할 이름과 데이터베이스로 식별되는 역할이 나열되며, 해당 역할 appAdmin에서 권한이 상속됩니다.

이 페이지의 내용