您好,在尝试保存数据库中的现有记录时,我收到 MongoBulkWriteException
服务器db2上的批量写入操作错误:27017。写错误:
[BulkWriteError {index = 0,code = 16837,message ='无法更新'版本' 和'版本'在同一时间',details = {}}]。 。 Stacktrace如下:
java.lang.reflect.InvocationTargetException:null at org.grails.core.DefaultGrailsControllerClass $ ReflectionInvoker.invoke(DefaultGrailsControllerClass.java:211) 在 org.grails.core.DefaultGrailsControllerClass.invoke(DefaultGrailsControllerClass.java:188) 在 org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:90) 在 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) 在 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) 在 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) 在 org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:883) 在 org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) 在 grails.plugin.springsecurity.rest.RestLogoutFilter.doFilter(RestLogoutFilter.groovy:82) 在 org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:317) 在 org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) 在 org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331) 在 org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) 在 grails.plugin.springsecurity.web.UpdateRequestContextHolderExceptionTranslationFilter.doFilter(UpdateRequestContextHolderExceptionTranslationFilter.groovy:64) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331) 在 grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.groovy:54) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331) 在 org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331) 在 org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331) 在 grails.plugin.springsecurity.rest.RestAuthenticationFilter.doFilter(RestAuthenticationFilter.groovy:139) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331) 在 org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331) 在 grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.groovy:64) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331) 在 org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331) 在 grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.groovy:58) 在 org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:331) 在 org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) 在 org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) 在 org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77) 在 org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:62) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 在 java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:624) 在java.lang.Thread.run(Thread.java:748)引起: com.mongodb.MongoBulkWriteException:批量写入操作错误 服务器db2:27017。写错误:[BulkWriteError {index = 0,code = 16837, message ='无法更新'版本'和'版本'在同一时间', details = {}}]。在 com.mongodb.connection.BulkWriteBatchCombiner.getError(BulkWriteBatchCombiner.java:176) 在 com.mongodb.connection.BulkWriteBatchCombiner.throwOnError(BulkWriteBatchCombiner.java:205) 在 com.mongodb.connection.BulkWriteBatchCombiner.getResult(BulkWriteBatchCombiner.java:146) 在 com.mongodb.operation.MixedBulkWriteOperation $ 1.call(MixedBulkWriteOperation.java:188) 在 com.mongodb.operation.MixedBulkWriteOperation $ 1.call(MixedBulkWriteOperation.java:168) 在 com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:426) 在 com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:417) 在 com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:168) 在 com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:74) 在com.mongodb.Mongo.execute(Mongo.java:845)at com.mongodb.Mongo $ 2.execute(Mongo.java:828)at com.mongodb.MongoCollectionImpl.bulkWrite(MongoCollectionImpl.java:301) 在 com.mongodb.MongoCollectionImpl.bulkWrite(MongoCollectionImpl.java:248) 在 org.grails.datastore.mapping.mongo.MongoSession.flush(MongoSession.java:197) 在 org.grails.datastore.mapping.mongo.AbstractMongoSession.flush(AbstractMongoSession.java:74) 在 org.grails.datastore.gorm.GormInstanceApi.doSave(GormInstanceApi.groovy:367) 在 org.grails.datastore.gorm.GormInstanceApi $ _save_closure5.doCall(GormInstanceApi.groovy:179) 在 org.grails.datastore.mapping.core.DatastoreUtils.execute(DatastoreUtils.java:319) 在 org.grails.datastore.gorm.AbstractDatastoreApi.execute(AbstractDatastoreApi.groovy:40) 在 org.grails.datastore.gorm.GormInstanceApi.save(GormInstanceApi.groovy:178) 在 org.grails.datastore.gorm.GormEntity $特质$ Helper.save(GormEntity.groovy:151) 在 com.lakshya.PermissionController $$ EQo2Eywh $ tt__update(PermissionController.groovy:77)。 在 grails.gorm.transactions.GrailsTransactionTemplate $ 2.doInTransaction(GrailsTransactionTemplate.groovy:94) 在 org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) 在 grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:91) 在 grails.gorm.transactions.GrailsTransactionTemplate $ 2.doInTransaction(GrailsTransactionTemplate.groovy:94) 在 org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) 在 grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:91) 在 org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) 在 org.springframework.aop.framework.CglibAopProxy $ CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) 在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) 在 org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) 在 com.ratetag.aspect.PerformanceMonitorAspect.profileWeb(PerformanceMonitorAspect.groovy:79) 在 org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629) 在 org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618) 在 org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) 在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 在 org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) 在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 在 org.springframework.aop.framework.CglibAopProxy $ DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) ...省略了40个常见帧