小编lim*_*uan的帖子

MongoTransactionException:查询失败,错误代码 251

在事务中查询文档时,仅使用特定 id(所有其他 id 都可以)时遇到此 Mongo 异常:

Exception occured: org.springframework.data.mongodb.MongoTransactionException: 
Query failed with error code 251 and error message 
'Given transaction number 1 does not match any in-progress transactions. The active transaction number is -1' on server mongo-1:27017; 
nested exception is com.mongodb.MongoQueryException: 
Query failed with error code 251 and error message 
'Given transaction number 1 does not match any in-progress transactions. The active transaction number is -1' on server mongo-1:27017 
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:136) 
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2902) 
at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:2810) 
at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:2555) 
at …
Run Code Online (Sandbox Code Playgroud)

mongodb spring-data-mongodb

8
推荐指数
2
解决办法
9210
查看次数

标签 统计

mongodb ×1

spring-data-mongodb ×1