[JAVA-2126] dup key on @CompoundIndexes Created: 27/Feb/16  Updated: 11/Sep/19  Resolved: 29/Feb/16

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 3.2.2
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: sorabh sahu Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

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



 Comments   
Comment by Ross Lawley [ 29/Feb/16 ]

The JAVA project is intended for reporting bugs against or requesting new features in the MongoDB Java driver. Please direct general usage questions about the driver or about MongoDB to our user forum or to Stack Overflow.

As this question seems related to Mongo Spring Data so posting on their forums may also they spring data community to be of assistance.

Regards,
Ross

Generated at Thu Feb 08 08:56:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.