Application Events


Application events are objects that represent individual actions or occurrences in different parts of your application. Stitch currently emits two types of application event: database events and authentication events.

Event Types

Database Events

Database events represent a change in a specific collection of your linked MongoDB cluster. Each event corresponds to a single change with one of the following operation types:

Operation Type Description
INSERT Represents a new document that was added to the collection.
UPDATE Represents a change to an existing document in the collection.
REPLACE Represents a new document that replaced a document in the collection.
DELETE Represents a document that was deleted from the collection.

Stitch uses MongoDB change streams to listen for changes in watched collections and map them to database events. Every database event has the same operation type and structure as a change event object that was emitted by the underlying change stream.


Stitch will only open change streams for collections with at least one enabled trigger.

Database event objects have the following general form:

   _id : <ObjectId>,
   "operationType": <string>,
   "fullDocument": <document>,
   "ns": {
      "db" : <string>,
      "coll" : <string>
   "documentKey": {
     "_id": <ObjectId>
   "updateDescription": <document>,
   "clusterTime": <Timestamp>


The fields that are included in a specific database event object are determined by the event’s operation type. See the change event reference page for examples and detailed descriptions of the change event object for each operation type.

Authentication Events

Authentication events represent user interactions with an authentication provider. Each event corresponds to a single user action with one of the following operation types:

Operation Type Description
LOGIN Represents a single instance of a user logging in.
CREATE Represents the creation of a new user.
DELETE Represents the deletion of a user.

Authentication event objects have the following form:

  "operationType": <string>,
  "providers": <array of strings>,
  "user": <user object>,
  "time": <ISODate>
Field Description
operationType The operation type of the authentication event.

The authentication providers that emitted the event.

Each authentication provider is represented by one of the following names:

  • "oauth2-google"
  • "oauth2-facebook"
  • "custom-token"
  • "local-userpass"
  • "api-key"
  • "anon-user"


Generally, only one authentication provider emits each event. If a user that is linked to multiple providers is deleted, the DELETE event for that user will include all linked providers.

user The user object of the user that interacted with the authentication provider.
time The time at which the event occurred.