public final class UpdateDescription extends Object
Modifier and Type | Method and Description |
---|---|
static UpdateDescription |
diff(BsonDocument beforeDocument,
BsonDocument afterDocument)
Find the diff between two documents.
|
boolean |
equals(Object obj) |
static UpdateDescription |
fromBsonDocument(BsonDocument document)
Converts an update description BSON document from a MongoDB Change Event into an
UpdateDescription object.
|
Collection<String> |
getRemovedFields()
Returns a
List containing the field names that have been removed in the corresponding
update. |
BsonDocument |
getUpdatedFields()
Returns a
BsonDocument containing keys and values representing (respectively) the
fields that have changed in the corresponding update and their new values. |
int |
hashCode() |
boolean |
isEmpty()
Determines whether this update description is empty.
|
UpdateDescription |
merge(UpdateDescription otherDescription)
Unilaterally merge an update description into this update description.
|
BsonDocument |
toBsonDocument()
Converts this update description to its document representation as it would appear in a
MongoDB Change Event.
|
BsonDocument |
toUpdateDocument()
Convert this update description to an update document.
|
public BsonDocument getUpdatedFields()
BsonDocument
containing keys and values representing (respectively) the
fields that have changed in the corresponding update and their new values.public Collection<String> getRemovedFields()
List
containing the field names that have been removed in the corresponding
update.public BsonDocument toUpdateDocument()
public BsonDocument toBsonDocument()
public static UpdateDescription fromBsonDocument(BsonDocument document)
document
- thepublic UpdateDescription merge(UpdateDescription otherDescription)
otherDescription
- the update description to merge into thispublic static UpdateDescription diff(BsonDocument beforeDocument, BsonDocument afterDocument)
NOTE: This does not do a full diff on [BsonArray]. If there is an inequality between the old and new array, the old array will simply be replaced by the new one.
beforeDocument
- original documentafterDocument
- document to diff onpublic boolean isEmpty()