Class UpdateDescription
- java.lang.Object
-
- com.mongodb.client.model.changestream.UpdateDescription
-
public final class UpdateDescription extends Object
The update description for changed fields in a$changeStream
operation.- Since:
- 3.6
-
-
Constructor Summary
Constructors Constructor Description UpdateDescription(List<String> removedFields, BsonDocument updatedFields)
Creates a new instanceUpdateDescription(List<String> removedFields, BsonDocument updatedFields, List<TruncatedArray> truncatedArrays)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
List<String>
getRemovedFields()
Returns the removedFieldsList<TruncatedArray>
getTruncatedArrays()
Returns information about the updated fields of the array type when the changes are reported as truncations.BsonDocument
getUpdatedFields()
Returns information about the updated fields excluding the fields reported viagetTruncatedArrays()
.int
hashCode()
String
toString()
-
-
-
Constructor Detail
-
UpdateDescription
public UpdateDescription(@Nullable List<String> removedFields, @Nullable BsonDocument updatedFields)
Creates a new instance- Parameters:
removedFields
- SeeUpdateDescription(List, BsonDocument, List)
.updatedFields
- SeeUpdateDescription(List, BsonDocument, List)
.- See Also:
UpdateDescription(List, BsonDocument, List)
-
UpdateDescription
public UpdateDescription(@Nullable @BsonProperty("removedFields") List<String> removedFields, @Nullable @BsonProperty("updatedFields") BsonDocument updatedFields, @Nullable @BsonProperty("truncatedArrays") List<TruncatedArray> truncatedArrays)
- Parameters:
removedFields
- Names of the fields that were removed.updatedFields
- Information about the updated fields.truncatedArrays
- Information about the updated fields of the array type when the changes are reported as truncations. Ifnull
, thengetTruncatedArrays()
returns an emptyList
.- Since:
- 4.3
-
-
Method Detail
-
getRemovedFields
@Nullable public List<String> getRemovedFields()
Returns the removedFields- Returns:
- the removedFields
-
getUpdatedFields
@Nullable public BsonDocument getUpdatedFields()
Returns information about the updated fields excluding the fields reported viagetTruncatedArrays()
.Despite array fields reported via
getTruncatedArrays()
being excluded from the information returned by this method, changes to fields of the elements of the array values may be reported via this method. For example, given the original field"arrayField": ["foo", {"a": "bar"}, 1, 2, 3]
and the updated field"arrayField": ["foo", {"a": "bar", "b": 3}]
, the following is how such a change may be reported:An example showing how the aforementioned change may be reported Method Result getUpdatedFields()
{"arrayField.1.b": 3} getTruncatedArrays()
{"field": "arrayField", "newSize": 2} - Returns:
updatedFields
.- See Also:
getTruncatedArrays()
-
getTruncatedArrays
@NonNull public List<TruncatedArray> getTruncatedArrays()
Returns information about the updated fields of the array type when the changes are reported as truncations.- Returns:
truncatedArrays
. There are no guarantees on the mutability of theList
returned.- Since:
- 4.3
- See Also:
getUpdatedFields()
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classObject
- Returns:
true
if and only if all of the following is true for the compared objects- Object.getClass() results are the same
- getRemovedFields() results are equal
- getUpdatedFields() results are equal
-
getTruncatedArrays() results are equal
or both contain no data (
null
or empty).
-
-