Specification

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:

  • If it's a delete operation, this field is omitted as the document no longer exists.
  • If it's an insert or replace operation, this will be the new value of the document.
  • If it's an update operation and we have enabled 'updateLookup', then it will have the most recently major-committed version of the document modified by the update operation.

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset