Package com.mongodb.event
Class CommandStartedEvent
java.lang.Object
com.mongodb.event.CommandEvent
com.mongodb.event.CommandStartedEvent
An event representing the start of a command execution.
- Since:
- 3.1
-
Constructor Summary
ConstructorDescriptionCommandStartedEvent
(int requestId, ConnectionDescription connectionDescription, String databaseName, String commandName, BsonDocument command) Deprecated.CommandStartedEvent
(RequestContext requestContext, int requestId, ConnectionDescription connectionDescription, String databaseName, String commandName, BsonDocument command) CommandStartedEvent
(RequestContext requestContext, long operationId, int requestId, ConnectionDescription connectionDescription, String databaseName, String commandName, BsonDocument command) Construct an instance. -
Method Summary
Modifier and TypeMethodDescriptionGets the command document.Gets the database on which the operation will be executed.Methods inherited from class com.mongodb.event.CommandEvent
getCommandName, getConnectionDescription, getOperationId, getRequestContext, getRequestId
-
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 contextoperationId
- the operation idrequestId
- the request idconnectionDescription
- the connection descriptiondatabaseName
- the database namecommandName
- the command namecommand
- the command as a BSON document- Since:
- 4.10
-
CommandStartedEvent
@Deprecated public CommandStartedEvent(@Nullable RequestContext requestContext, int requestId, ConnectionDescription connectionDescription, String databaseName, String commandName, BsonDocument command) Deprecated.Construct an instance.- Parameters:
requestContext
- the request contextrequestId
- the request idconnectionDescription
- the connection descriptiondatabaseName
- the database namecommandName
- the command namecommand
- the command as a BSON document- Since:
- 4.4
-
CommandStartedEvent
@Deprecated public CommandStartedEvent(int requestId, ConnectionDescription connectionDescription, String databaseName, String commandName, BsonDocument command) Deprecated.Construct an instance.- Parameters:
requestId
- the request idconnectionDescription
- the connection descriptiondatabaseName
- the database namecommandName
- the command namecommand
- the command as a BSON document
-
-
Method Details
-
getDatabaseName
Gets the database on which the operation will be executed.- Returns:
- the database name
-
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 viaObject.clone()
.- Returns:
- the command document
-
CommandStartedEvent(RequestContext, long, int, ConnectionDescription, String, String, BsonDocument)