Class CommandStartedEvent


  • public final class CommandStartedEvent
    extends CommandEvent
    An event representing the start of a command execution.
    Since:
    3.1
    • Constructor Detail

      • CommandStartedEvent

        public CommandStartedEvent​(@Nullable
                                   RequestContext requestContext,
                                   int requestId,
                                   ConnectionDescription connectionDescription,
                                   String databaseName,
                                   String commandName,
                                   BsonDocument command)
        Construct an instance.
        Parameters:
        requestContext - the request context
        requestId - the request id
        connectionDescription - the connection description
        databaseName - the database name
        commandName - the command name
        command - the command as a BSON document
        Since:
        4.4
      • CommandStartedEvent

        public CommandStartedEvent​(int requestId,
                                   ConnectionDescription connectionDescription,
                                   String databaseName,
                                   String commandName,
                                   BsonDocument command)
        Construct an instance.
        Parameters:
        requestId - the request id
        connectionDescription - the connection description
        databaseName - the database name
        commandName - the command name
        command - the command as a BSON document
    • Method Detail

      • getDatabaseName

        public String getDatabaseName()
        Gets the database on which the operation will be executed.
        Returns:
        the database name
      • getCommand

        public BsonDocument getCommand()
        Gets the command document. The document is only usable within the method that delivered the event. If it's needed for longer, it must be cloned via Object.clone().
        Returns:
        the command document