Getting “err” : "E11000 duplicate key error when inserting into mongo using the Java driver
问题 Exception in thread "main" com.mongodb.MongoException$DuplicateKey: { "serverUsed" : "localhost/127.0.0.1:27017" , "err" : "E11000 duplicate key error index: twitterdb03.LevelAFollowers.$ id dup key: { : ObjectId('52d5636de408652b4853a8fe') }" , "code" : 11000 , "n" : 0 , "connectionId" : 12 , "ok" : 1.0} I'm using mongo 2.11.1 Never had problems with simple write operations in java myMap.put(inid, followersList); myObj.putAll(myMap); myIdMapCollection.insert(myObj); 回答1: I found an answer on