263 OperationNotSupportedInTransaction: Operation not supported inside a multi-document transaction(多文档事务中不支持该操作)
MongoDB含义
在多文档事务中尝试执行了在该上下文中不支持的操作。某些命令(尤其是部分 DDL 和元数据操作)无法在事务中运行。
原因
事务中不支持的操作,例如创建集合/索引(取决于版本);某些 count/list 类命令;或在事务会话中无效的管理命令。旧版 MongoDB 不支持在事务中执行 DDL(部分支持自 4.4+ 起提供)。
解决方法
将不支持的操作移出事务(例如在事务开始前创建所需的集合/索引)。检查 MongoDB 版本;4.4+ 支持在事务中执行部分 DDL。在驱动中用单独的会话运行该操作。将事务限制在受支持的 CRUD 操作范围内。
同一数据库的其他条目
- 134ReadConcernMajorityNotAvailableYet
- 202NetworkInterfaceExceededTimeLimit
- 31 RoleNotFoundRole not found(未找到角色)
- 20 IllegalOperationIllegal operation(非法操作)
- 48 NamespaceExistsNamespace (collection) already exists(命名空间(集合)已存在)
- 11601 InterruptedOperation was interrupted(操作被中断)
- 85 IndexOptionsConflictIndex already exists with different options / different name(索引已存在但选项不同/名称不同)