Package com.mongodb

Class CommandResult

  • All Implemented Interfaces:
    DBObject, java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,​java.lang.Object>, BSONObject, Bson

    @Deprecated(since="2021-05-27")
    public class CommandResult
    extends BasicDBObject
    Deprecated.
    Usage of this API is not supported in AEM as a Cloud Service.
    A simple wrapper to hold the result of a command. All the fields from the response document have been added to this result.
    See Also:
    Serialized Form
    • Method Detail

      • ok

        public boolean ok()
        Deprecated.
        Gets the "ok" field, which is whether this command executed correctly or not.
        Returns:
        true if the command executed without error.
      • getErrorMessage

        @Nullable
        public java.lang.String getErrorMessage()
        Deprecated.
        Gets the error message associated with a failed command.
        Returns:
        The error message or null
      • getException

        @Nullable
        public MongoException getException()
        Deprecated.
        Utility method to create an exception from a failed command.
        Returns:
        The mongo exception, or null if the command was successful.
      • throwOnError

        public void throwOnError()
        Deprecated.
        Throws a CommandFailureException if the command failed. Otherwise, returns normally.
        Throws:
        MongoException - with the exception from the failed command
        See Also:
        ok()