Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2126

dup key on @CompoundIndexes

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 3.2.2
    • None
    • None
    • java 8, mongo Spring data,

    Description

      I have created pojo class and use this annotation:-

      @CompoundIndexes(value = { @CompoundIndex(name = "Metadata _ind1", def = "

      {'index': 1, 'projectId': 1}

      ", unique = true) })
      @Document(collection = "metadata")
      public class MetadataCommBean

      { -- variables-- -- getter/ setter-- }

      and after sum updation on my list of documents i am saving my updates in collection by using mononRepository.save(updatedList)
      and this statement throws error:-

      com.mongodb.MongoException$DuplicateKey: { "serverUsed" : "localhost:27017" , "ok" : 1 , "n" : 0 , "updatedExisting" : false ,
      "err" : "E11000 duplicate key error collection: metadata_db.metadata index: Metadata _ind1 dup key: { : \"1.1.2\", : \"11\" }" , "code" : 11000}

      how can i solve this

      Attachments

        Activity

          People

            Unassigned Unassigned
            sorav.sahu@gmail.com sorabh sahu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: