Package com.mongodb

Class DuplicateKeyException

All Implemented Interfaces:

public class DuplicateKeyException extends WriteConcernException
The legacy WriteConcernException, thrown when trying to insert or update a document containing a duplicate key.

Only thrown when using the legacy deprecated API, which is accessed via com.mongodb.MongoClient.getDB.

For application using the MongoCollection-based API, duplicate key exceptions can be determined via:

See Also:
  • Constructor Details

    • DuplicateKeyException

      public DuplicateKeyException(BsonDocument response, ServerAddress address, WriteConcernResult writeConcernResult)
      Construct an instance.
      response - the response from the server
      address - the server address
      writeConcernResult - the write concern result