Class UpdateDescription
$changeStream
operation.- Since:
- 3.6
-
Constructor Summary
ConstructorDescriptionUpdateDescription
(List<String> removedFields, BsonDocument updatedFields) Creates a new instanceUpdateDescription
(List<String> removedFields, BsonDocument updatedFields, List<TruncatedArray> truncatedArrays) UpdateDescription
(List<String> removedFields, BsonDocument updatedFields, List<TruncatedArray> truncatedArrays, BsonDocument disambiguatedPaths) -
Method Summary
Modifier and TypeMethodDescriptionboolean
A document containing a map that associates an update path to an array containing the path components used in the update document.Returns the removedFieldsReturns information about the updated fields of the array type when the changes are reported as truncations.Returns information about the updated fields excluding the fields reported viagetTruncatedArrays()
.int
hashCode()
toString()
-
Constructor Details
-
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
public UpdateDescription(@Nullable List<String> removedFields, @Nullable BsonDocument updatedFields, @Nullable 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
-
UpdateDescription
public UpdateDescription(@Nullable @BsonProperty("removedFields") List<String> removedFields, @Nullable @BsonProperty("updatedFields") BsonDocument updatedFields, @Nullable @BsonProperty("truncatedArrays") List<TruncatedArray> truncatedArrays, @Nullable @BsonProperty("disambiguatedPaths") BsonDocument disambiguatedPaths) - 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
.disambiguatedPaths
- a document containing a map that associates an update path to an array containing the path components used in the update document.- Since:
- 4.8
-
-
Method Details
-
getRemovedFields
Returns the removedFields- Returns:
- the removedFields
-
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
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:
-
getDisambiguatedPaths
A document containing a map that associates an update path to an array containing the path components used in the update document.This data can be used in combination with the other fields in an `UpdateDescription` to determine the actual path in the document that was updated. This is necessary in cases where a key contains dot-separated strings (i.e.,
{"a.b": "c"}
) or a document contains a numeric literal string key (i.e.,{ "a": { "0": "a" } }
. Note that in this scenario, the numeric key can't be the top level key, because{ "0": "a" }
is not ambiguous - update paths would simply be'0'
which is unambiguous because BSON documents cannot have arrays at the top level.).Each entry in the document maps an update path to an array which contains the actual path used when the document was updated. For example, given a document with the following shape
{ "a": { "0": 0 } }
and an update of{ $inc: { "a.0": 1 } }
,disambiguatedPaths
would look like the following:{ "a.0": ["a", "0"] }
.In each array, all elements will be returned as strings, except for array indices, which will be returned as 32-bit integers.
- Returns:
- the disambiguated paths as a BSON document, which may be null
- Since:
- 4.8
- Since server release
- 6.1
-
equals
- 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).
-
hashCode
public int hashCode() -
toString
-