Class UpdateDescription

  • public final class UpdateDescription
    extends Object
    Indicates which fields have been modified in a given update operation.
    • Method Detail

      • getUpdatedFields

        public BsonDocument getUpdatedFields()
        Returns a BsonDocument containing keys and values representing (respectively) the fields that have changed in the corresponding update and their new values.
        the updated field names and their new values.
      • getRemovedFields

        public Collection<String> getRemovedFields()
        Returns a List containing the field names that have been removed in the corresponding update.
        the removed fields names.
      • toUpdateDocument

        public BsonDocument toUpdateDocument()
        Convert this update description to an update document.
        an update document with the appropriate $set and $unset documents.
      • toBsonDocument

        public BsonDocument toBsonDocument()
        Converts this update description to its document representation as it would appear in a MongoDB Change Event.
        the update description document as it would appear in a change event
      • fromBsonDocument

        public static UpdateDescription fromBsonDocument​(BsonDocument document)
        Converts an update description BSON document from a MongoDB Change Event into an UpdateDescription object.
        document - the
        the converted UpdateDescription
      • merge

        public UpdateDescription merge​(@Nullable
                                       UpdateDescription otherDescription)
        Unilaterally merge an update description into this update description.
        otherDescription - the update description to merge into this
        this merged update description
      • diff

        public static UpdateDescription diff​(@Nullable
                                             BsonDocument beforeDocument,
                                             BsonDocument afterDocument)
        Find the diff between two documents.

        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 document
        afterDocument - document to diff on
        a description of the updated fields and removed keys between the documents.
      • isEmpty

        public boolean isEmpty()
        Determines whether this update description is empty.
        true if the update description is empty, false otherwise
      • hashCode

        public int hashCode()
        hashCode in class Object