This is an automated email from the ASF dual-hosted git repository.
corgy pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 60f1007ab3 [Doc][MongoDB] Update CDC documentation for role and user
creation with clearer examples (#10423)
60f1007ab3 is described below
commit 60f1007ab3b45220e22835bd23cc7a6393ec6b2d
Author: Jast <[email protected]>
AuthorDate: Sat Jan 31 23:51:40 2026 +0800
[Doc][MongoDB] Update CDC documentation for role and user creation with
clearer examples (#10423)
---
docs/en/connectors/source/MongoDB-CDC.md | 61 +++++++++++++++++---------------
docs/zh/connectors/source/MongoDB-CDC.md | 61 +++++++++++++++++---------------
2 files changed, 66 insertions(+), 56 deletions(-)
diff --git a/docs/en/connectors/source/MongoDB-CDC.md
b/docs/en/connectors/source/MongoDB-CDC.md
index 42945a10b1..3656eb4497 100644
--- a/docs/en/connectors/source/MongoDB-CDC.md
+++ b/docs/en/connectors/source/MongoDB-CDC.md
@@ -41,36 +41,41 @@ They can be downloaded via install-plugin.sh or from the
Maven central repositor
4.Permissions:changeStream and read
-```shell
-use admin;
-db.createRole(
+```
+// 1) Switch to the target database
+use <DB_NAME>
+
+// 2) Create role (common permissions for CDC scenarios)
+db.createRole({
+ role: "<ROLE_NAME>",
+ privileges: [
{
- role: "strole",
- privileges: [{
- resource: { db: "", collection: "" },
- actions: [
- "splitVector",
- "listDatabases",
- "listCollections",
- "collStats",
- "find",
- "changeStream" ]
- }],
- roles: [
- { role: 'read', db: 'config' }
- ]
- }
-);
-
-db.createUser(
- {
- user: 'stuser',
- pwd: 'stpw',
- roles: [
- { role: 'strole', db: 'admin' }
+ resource: { db: "<DB_NAME>", collection: "" },
+ actions: [
+ "collStats",
+ "splitVector",
+ "listDatabases",
+ "find",
+ "listCollections",
+ "changeStream"
]
- }
-);
+ }
+ ],
+ roles: []
+})
+
+// 3) Create user and bind read + custom role
+db.createUser({
+ user: "<USER_NAME>",
+ pwd: "<PASSWORD>",
+ roles: [
+ { role: "read", db: "<DB_NAME>" },
+ { role: "<ROLE_NAME>", db: "<DB_NAME>" }
+ ]
+})
+
+// 4) Grant additional role to user (use when user exists or additional
authorization is needed)
+db.grantRolesToUser("<USER_NAME>", ["<ROLE_NAME>"])
```
## Data Type Mapping
diff --git a/docs/zh/connectors/source/MongoDB-CDC.md
b/docs/zh/connectors/source/MongoDB-CDC.md
index 2335600344..0770da5054 100644
--- a/docs/zh/connectors/source/MongoDB-CDC.md
+++ b/docs/zh/connectors/source/MongoDB-CDC.md
@@ -41,36 +41,41 @@ MongoDB CDC连接器允许从MongoDB数据库读取快照数据和增量数据
4.权限:更改流和读取
-```shell
-use admin;
-db.createRole(
+```
+// 1) 切换到目标数据库
+use <DB_NAME>
+
+// 2) 创建角色(CDC 场景常用权限)
+db.createRole({
+ role: "<ROLE_NAME>",
+ privileges: [
{
- role: "strole",
- privileges: [{
- resource: { db: "", collection: "" },
- actions: [
- "splitVector",
- "listDatabases",
- "listCollections",
- "collStats",
- "find",
- "changeStream" ]
- }],
- roles: [
- { role: 'read', db: 'config' }
- ]
- }
-);
-
-db.createUser(
- {
- user: 'stuser',
- pwd: 'stpw',
- roles: [
- { role: 'strole', db: 'admin' }
+ resource: { db: "<DB_NAME>", collection: "" },
+ actions: [
+ "collStats",
+ "splitVector",
+ "listDatabases",
+ "find",
+ "listCollections",
+ "changeStream"
]
- }
-);
+ }
+ ],
+ roles: []
+})
+
+// 3) 创建用户,并绑定 read + 自定义角色
+db.createUser({
+ user: "<USER_NAME>",
+ pwd: "<PASSWORD>",
+ roles: [
+ { role: "read", db: "<DB_NAME>" },
+ { role: "<ROLE_NAME>", db: "<DB_NAME>" }
+ ]
+})
+
+// 4) 为用户追加授予角色(用户已存在或需要补授权时使用)
+db.grantRolesToUser("<USER_NAME>", ["<ROLE_NAME>"])
```
## 数据类型映射