Class CommandEventAbstract

Common base class for all command events.

Note that these emit real commands, not any abstracted commands like "bulkWrite", "insertMany", or "deleteAll", which have to be translated into appropriate Data API commands.

Hierarchy (view full)

Constructors

Properties

collection?: string

The collection the command is being run on, if applicable.

command: Record<string, any>

The command object. Equal to the response body of the HTTP request.

Note that this is the actual raw command object; it's not necessarily 1:1 with methods called on the collection/db.

For example, a deleteAll method on a collection will be translated into a deleteMany command, and a bulkWrite method will be translated into a series of insertOne, updateOne, etc. commands.

Example

{
  insertOne: { document: { name: 'John' } }
}
commandName: string

The command name.

This is the key of the command object. For example, if the command object is { insertOne: { document: { name: 'John' } } }, the command name is insertOne.

Meaning, abstracted commands like bulkWrite, or deleteAll will be shown as their actual command equivalents.

namespace: string

The namespace the command is being run in.

url: string

The URL the command is being sent to.