java.lang.IllegalArgumentException: Replacements can not be multi


I am using the following s/w and their versions :

  • mongodb : 3.4.10
  • spring-data-mongodb : 2.10.1.RELEASE
  • mongodb java driver : 3.4.3
  • spring boot : 1.5.10.RELEASE

Mongo db schema :

        "_id" : ObjectId("some id"),
        "a":{/* Complex Structure */},
        "b": [/* Array of transaction records */], 
        "c": {/* Some additional 50 fields with mixture of various data types  */ }

Java code : TransactionMap class is a java.util.HashMap

    mongoTemplate.updateFirst(query, update, TransactionMap.class);

Exception traced :

         java.lang.IllegalArgumentException: Replacements can not be multi

Please share when will the above exception be thrown and how to resolve the same.



Hi @senthil_kumar1 and welcome to the MongoDB community forum!!

We are eager to assist you in resolving the issues you are encountering. However, the information provided is not adequate for us to fully comprehend the underlying cause of the error at hand.

Primarily, it is noteworthy that the version of MongoDB you are currently utilising has reached its end of life. Consequently, no further updates or support are available for this version. Therefore, it is strongly advised to upgrade to the latest version of MongoDB along with its corresponding compatible Java driver for latest updates and bug fixes.

Should the issue persist post-update, we kindly request your assistance in providing the complete update command. This will enable us to accurately replicate the error and further diagnose the issue.

Best regards