title: com.mongodb.MongoException: org.springframework.data.mongodb.MongoTransactionException: Command failed with error 251 (NoSuchTransaction):
body: <p>I have next code</p>
  
  <pre><code>public void updateComics(ReceiverRecord&lt;String, UpdateTask&gt; record) {
  
    UpdateTask task = record.value();
  
    List&lt;PageMD&gt; pageList = task.getPages().stream().map(PageMD::new).collect(Collectors.toList());
    Comics comic = task.getComics();
    PageMD lastPage = Iterables.getLast(pageList);
    comic.setLastUpdate(LocalDateTime.now());
    comic.setPageCount(lastPage.getNumber());
  
    transactionalOperator.execute(status -&gt; pageRepos.saveAll(pageList)
             .doOnNext(page -&gt; logger.info("page save = {} ", page))
             .doOnError(err -&gt; logger.error("Error saving page ", err))
             .then(comicsRepos.save(new ComicsMD(comic)))
             .doOnNext(com -&gt; logger.info("comic save = {}", com))
             .doOnError(com -&gt; {
                      logger.error("error saving comic ", com);
                      status.setRollbackOnly();
              }))
             .doOnError(error -&gt; logger.error("An error happen while execute transaction = ", error))
             .subscribe();
  }
  </code></pre>
  
  <p>And I have error when I save data (pages) in mongodb</p>
  
  <pre><code>com.mongodb.MongoException: org.springframework.data.mongodb.MongoTransactionException: 
  Command failed with error 251 (NoSuchTransaction): 'Given transactionnumber 1 does not match any in-progress transactions. The active transaction number is -1' on server mongo:27017. 
  The full response is {"errorLabels": ["TransientTransactionError"], "operationTime": {"$timestamp": {"t": 1587986663, "i": 1}}, "ok": 0.0, "errmsg": "Given transaction number 1 does not match any in-progress transactions. 
  The active transaction number is -1", "code": 251, "codeName": "NoSuchTransaction", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1587986663, "i": 1}}, "signature": {"hash": {"$binary": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "$type": "00"}, "keyId": {"$numberLong": "0"}}}}; nested exception is com.mongodb.MongoCommandException: Command failed with error 251 (NoSuchTransaction): 'Given transaction number 1 does not match any in-progress transactions. The active transaction number is -1' on server mongo:27017. The full response is {"errorLabels": ["TransientTransactionError"], "operationTime": {"$timestamp": {"t": 1587986663, "i": 1}}, "ok": 0.0, "errmsg": "Given transaction number 1 does not match any in-progress transactions. The active transaction number is -1", "code": 251, "codeName": "NoSuchTransaction", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1587986663, "i": 1}}, "signature": {"hash": {"$binary": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "$type": "00"}, "keyId": {"$numberLong": "0"}}}}
  parsers-manager            |   
   at com.mongodb.MongoException.fromThrowableNonNull(MongoException.java:79) ~[mongodb-driver-core-3.11.2.jar!/:na]
  </code></pre>
  
  <p>Whithout reactive transaction it is work. How can I fix this?</p>