The following document shows all of the possible fields that a change event response may or may not include, depending on the actual change that happened:
{ _id : { <BSON Object> },
"operationType" : "<operation>",
"fullDocument" : { <document> },
"ns" : {
"db" : "<database>",
"coll" : "<collection"
},
"documentKey" : { "_id" : <ObjectId> },
"updateDescription" : {
"updatedFields" : { <document> },
"removedFields" : [ "<field>", ... ]
}
"clusterTime" : <Timestamp>,
"txnNumber" : <NumberLong>,
"lsid" : {
"id" : <UUID>,
"uid" : <BinData>
}
}
The most important fields are as follows:
fullDocument |
This is the new state of the document, which can include the following:
|
operationType |
This is the type of operation; it can be either of insert, delete, replace, update, or invalidate. |
documentKey |
This is ObjectID of the document that was affected by the operation. |
updateDescription.updatedFields / removedFields |
This is a document or an array of keys respectively, showing the data that was updated or removed by the update or remove operation. |
txnNumber |
This is the transaction number. It is only applicable if the operation is part of a multi-document ACID (atomicity, consistency, isolation, durability) transaction. |
lsid |
This is the session identifier of the transaction. It is only applicable if the operation is part of a multi-document ACID transaction. |