TDocument
- The type that this collection will encode the fullDocument
field into.public final class ChangeStreamDocument<TDocument> extends Object
$changeStream
aggregation output document.
Note: this class will not be applicable for all change stream outputs. If using custom pipelines that radically change the change stream result, then an alternative document format should be used.
Constructor | Description |
---|---|
ChangeStreamDocument(BsonDocument resumeToken,
MongoNamespace namespace,
TDocument fullDocument,
BsonDocument documentKey,
OperationType operationType,
UpdateDescription updateDescription) |
|
ChangeStreamDocument(BsonDocument resumeToken,
MongoNamespace namespace,
TDocument fullDocument,
BsonDocument documentKey,
BsonTimestamp clusterTime,
OperationType operationType,
UpdateDescription updateDescription) |
Deprecated.
|
ChangeStreamDocument(BsonDocument resumeToken,
BsonDocument namespaceDocument,
TDocument fullDocument,
BsonDocument documentKey,
BsonTimestamp clusterTime,
OperationType operationType,
UpdateDescription updateDescription) |
Creates a new instance
|
Modifier and Type | Method | Description |
---|---|---|
static <TFullDocument> |
createCodec(Class<TFullDocument> fullDocumentClass,
CodecRegistry codecRegistry) |
Creates the codec for the specific ChangeStreamOutput type
|
boolean |
equals(Object o) |
|
BsonTimestamp |
getClusterTime() |
Gets the cluster time at which the change occurred.
|
String |
getDatabaseName() |
Returns the database name
|
BsonDocument |
getDocumentKey() |
Returns a document containing just the _id of the changed document.
|
TDocument |
getFullDocument() |
Returns the fullDocument
|
MongoNamespace |
getNamespace() |
Returns the namespace
The invalidate operation type does include a MongoNamespace in the ChangeStreamDocument response.
|
BsonDocument |
getNamespaceDocument() |
Returns the namespaceDocument
The namespaceDocument is a BsonDocument containing the values associated with a MongoNamespace.
|
OperationType |
getOperationType() |
Returns the operationType
|
BsonDocument |
getResumeToken() |
Returns the resumeToken
|
UpdateDescription |
getUpdateDescription() |
Returns the updateDescription
|
int |
hashCode() |
|
String |
toString() |
@Deprecated public ChangeStreamDocument(BsonDocument resumeToken, MongoNamespace namespace, TDocument fullDocument, BsonDocument documentKey, OperationType operationType, UpdateDescription updateDescription)
ChangeStreamDocument(BsonDocument, MongoNamespace, Object, BsonDocument, BsonTimestamp, OperationType,
UpdateDescription)
resumeToken
- the resume tokennamespace
- the namespacedocumentKey
- a document containing the _id of the changed documentfullDocument
- the fullDocumentoperationType
- the operation typeupdateDescription
- the update description@Deprecated public ChangeStreamDocument(BsonDocument resumeToken, MongoNamespace namespace, TDocument fullDocument, BsonDocument documentKey, @Nullable BsonTimestamp clusterTime, OperationType operationType, UpdateDescription updateDescription)
resumeToken
- the resume tokennamespace
- the namespacedocumentKey
- a document containing the _id of the changed documentclusterTime
- the cluster time at which the change occurredfullDocument
- the fullDocumentoperationType
- the operation typeupdateDescription
- the update descriptionpublic ChangeStreamDocument(@BsonProperty("resumeToken") BsonDocument resumeToken, @BsonProperty("ns") BsonDocument namespaceDocument, @BsonProperty("fullDocument") TDocument fullDocument, @BsonProperty("documentKey") BsonDocument documentKey, @Nullable @BsonProperty("clusterTime") BsonTimestamp clusterTime, @BsonProperty("operationType") OperationType operationType, @BsonProperty("updateDescription") UpdateDescription updateDescription)
resumeToken
- the resume tokennamespaceDocument
- the BsonDocument representing the namespacefullDocument
- the full documentdocumentKey
- a document containing the _id of the changed documentclusterTime
- the cluster time at which the change occuredoperationType
- the operation typeupdateDescription
- the update descriptionpublic BsonDocument getResumeToken()
@BsonIgnore @Nullable public MongoNamespace getNamespace()
@BsonProperty("ns") public BsonDocument getNamespaceDocument()
@BsonIgnore @Nullable public String getDatabaseName()
public TDocument getFullDocument()
public BsonDocument getDocumentKey()
For unsharded collections this contains a single field, _id, with the value of the _id of the document updated. For sharded collections, this will contain all the components of the shard key in order, followed by the _id if the _id isn’t part of the shard key.
@Nullable public BsonTimestamp getClusterTime()
public OperationType getOperationType()
public UpdateDescription getUpdateDescription()
public static <TFullDocument> Codec<ChangeStreamDocument<TFullDocument>> createCodec(Class<TFullDocument> fullDocumentClass, CodecRegistry codecRegistry)
TFullDocument
- the fullDocument typefullDocumentClass
- the class to use to represent the fullDocumentcodecRegistry
- the codec registry