Class CommandStartedEvent

java.lang.Object
com.mongodb.event.CommandEvent
com.mongodb.event.CommandStartedEvent

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

    • CommandStartedEvent

      public CommandStartedEvent(@Nullable RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String databaseName, String commandName, BsonDocument command)
      Construct an instance.
      Parameters:
      requestContext - the request context
      operationId - the operation id
      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.10
  • Method Details

    • 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