对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。

用户权限

mongosync连接字符串中指定的用户必须对源集群和目标集群具有所需的权限。权限因您的环境以及您是否要使用反向同步而异。

自我托管权限包括:

有关服务器角色的详细信息,请参阅:自托管部署中基于角色的访问控制。

要更新用户权限,请参阅: grantRolesToUser 。

除了表中的角色外,还需使用自定义角色预配以下源权限:

{ "resource": { "db": "local", "collection": "oplog.rs" }, "actions": [ "find", "collStats" ]}

Atlas 权限包括:

同步类型
所需的源权限
所需的目标权限

默认

  • atlasAdmin

冲销或多重冲销

有关Atlas角色的详细信息,请参阅Atlas用户角色。

要更新Atlas user权限,请参阅:管理对项目的访问权限。

注意

最低权限可能会在不同的 Mongosync 版本中变化。

最低特权仅应用于本地部署,因为无法使用自定义角色在Atlas中创建某些特权操作。

最低源权限为:

同步类型
最低源权限

默认

[ { "resource": { "cluster": true }, "actions": [ "appendOplogNote", "bypassWriteBlockingMode", "getDefaultRWConcern", "getShardMap", "hostInfo", "listDatabases", "listShards", "replSetGetConfig", "replSetGetStatus", "serverStatus", "setUserWriteBlockMode" ] }, { "resource": { "db": "", "collection": "" }, "actions": [ "changeStream", "collStats", "find", "indexStats", "listCollections", "listIndexes" ] }, { "resource": { "db": "local", "collection": "oplog.rs" }, "actions": [ "find", "collStats" ] }, { "resource": { "db": "admin", "collection": "system.version" }, "actions": [ "find", "collStats" ] }, { "resource": { "db": "", "collection": "system.js" }, "actions": [ "listCollections", "listIndexes" ] }, { "resource": { "db": "config", "collection": "shards" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "collections" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "version" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "settings" }, "actions": [ "find", "update" ] }, { "resource": { "system_buckets": "" }, "actions": [ "listCollections", "listIndexes" ] }]

反转

一切都来自默认的源权限和默认的目标权限。

多重反转

默认源权限和默认目标权限的所有内容,并添加:

[ { "resource": { "db": "", "collection": "" }, "actions": [ "dropDatabase" ] }]

V5.0 迁移

[ { "resource": { "cluster": true }, "actions": [ "appendOplogNote", "getDefaultRWConcern", "getShardMap", "hostInfo", "listDatabases", "listShards", "replSetGetConfig", "replSetGetStatus", "serverStatus" ] }, { "resource": { "db": "", "collection": "" }, "actions": [ "changeStream", "collStats", "find", "indexStats", "listCollections", "listIndexes" ] }, { "resource": { "db": "admin", "collection": "system.version" }, "actions": [ "find" ] }, { "resource": { "db": "", "collection": "system.js" }, "actions": [ "listCollections", "listIndexes" ] }, { "resource": { "db": "config", "collection": "shards" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "collections" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "version" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "settings" }, "actions": [ "find", "update" ] }]

最低目标权限为:

同步类型
最低目标权限

默认

[ { "resource": { "cluster": true }, "actions": [ "appendOplogNote", "getDefaultRWConcern", "getShardMap", "hostInfo", "listDatabases", "listShards", "replSetGetConfig", "replSetGetStatus", "serverStatus" ] }, { "resource": { "db": "", "collection": "" }, "actions": [ "bypassDocumentValidation", "changeStream", "collMod", "convertToCapped", "createCollection", "createIndex", "dropCollection", "dropIndex", "enableSharding", "find", "indexStats", "insert", "listCollections", "listIndexes", "remove", "renameCollectionSameDB", "update", "bypassWriteBlockingMode", "setUserWriteBlockMode" ] }, { "resource": { "db": "admin", "collection": "system.version" }, "actions": [ "find", "collStats" ] }, { "resource": { "db": "", "collection": "system.js" }, "actions": [ "listCollections", "listIndexes" ] }, { "resource": { "db": "", "collection": "system.views" }, "actions": [ "dropCollection" ] }, { "resource": { "db": "config", "collection": "version" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "collections" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "settings" }, "actions": [ "find", "update" ] }, { "resource": { "db": "config", "collection": "shards" }, "actions": [ "find", "update" ] }, { "resource": { "db": "config", "collection": "tags" }, "actions": [ "find", "update", "remove" ] }, { "resource": { "system_buckets": "" }, "actions": [ "listCollections", "listIndexes" ] }]

反转

默认源权限和默认目标权限的所有内容,并添加:

[ { "resource": { "db": "", "collection": "" }, "actions": [ "dropDatabase" ] }]

多重反转

默认源权限和默认目标权限的所有内容,并添加:

[ { "resource": { "db": "", "collection": "" }, "actions": [ "dropDatabase" ] }]

从 5.0源集群迁移时,源集群应具有 clusterManager 或为 v5.0 列出的最低权限。

v5.0 的最低源权限是:

同步类型
最低源权限

V5.0 迁移

[ { "resource": { "cluster": true }, "actions": [ "appendOplogNote", "getDefaultRWConcern", "getShardMap", "hostInfo", "listDatabases", "listShards", "replSetGetConfig", "replSetGetStatus", "serverStatus" ] }, { "resource": { "db": "", "collection": "" }, "actions": [ "changeStream", "collStats", "find", "indexStats", "listCollections", "listIndexes" ] }, { "resource": { "db": "admin", "collection": "system.version" }, "actions": [ "find" ] }, { "resource": { "db": "", "collection": "system.js" }, "actions": [ "listCollections", "listIndexes" ] }, { "resource": { "db": "config", "collection": "shards" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "collections" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "version" }, "actions": [ "find" ] }, { "resource": { "db": "config", "collection": "settings" }, "actions": [ "find", "update" ] }]