- Change Streams >
- Change Events
Change Events¶
On this page
Change streams watch collections, databases, or deployments for changes.
When a change occurs on a watched resource, the change stream returns a change event notification document, with information on the operation and the changes it made.
Operation Types¶
Event | Description |
---|---|
delete |
Occurs when a document is removed from the collection. |
drop |
Occurs when a collection is dropped from a database. New in version 4.0.1. |
dropDatabase |
Occurs when a database is dropped. New in version 4.0.1. |
insert |
Occurs when an operation adds documents to a collection. |
invalidate |
Occurs when an operation renders the change stream invalid. |
rename |
Occurs when a collection is renamed. New in version 4.0.1. |
replace |
Occurs when an update operation removes a document from a collection and replaces it with a new document. |
update |
Occurs when an operation updates a document in a collection. |
Resume Token¶
Each change event includes an _id
field, which contain a document. This
document can serve as the resume token when
starting a change stream.