Package com.mongodb

Class MongoUpdatedEncryptedFieldsException

All Implemented Interfaces:
Serializable

public final class MongoUpdatedEncryptedFieldsException extends MongoClientException
An exception thrown by methods that may automatically create data encryption keys where needed based on the encryptedFields configuration.
Since:
4.9
See Also:
  • Constructor Details

    • MongoUpdatedEncryptedFieldsException

      public MongoUpdatedEncryptedFieldsException(BsonDocument encryptedFields, String msg, Throwable cause)
      Not part of the public API.
      Parameters:
      encryptedFields - The (partially) updated encryptedFields document, which allows users to infer which data keys are known to be created before the exception happened (see getEncryptedFields() for more details). Reporting this back to a user may be helpful because creation of a data key includes persisting it in the key vault.
      msg - The message.
      cause - The cause.
  • Method Details

    • getEncryptedFields

      public BsonDocument getEncryptedFields()
      The encryptedFields document that allows inferring which data keys are known to be created before this exception happened by comparing this document with the original encryptedFields configuration. Creation of a data key includes persisting it in the key vault.

      Note that the returned encryptedFields document is not guaranteed to contain information about all the data keys that may be created, only about those that the driver is certain about. For example, if persisting a data key times out, the driver does not know whether it can be considered created or not, and does not include the information about the key in the encryptedFields document. You can analyze whether the cause is a definite or indefinite error, and rely on the returned encryptedFields to be containing information on all created keys only if the error is definite.

      Returns:
      The updated encryptedFields document.