Table of Contents

Class MongoDbDataChangeEvent

Namespace
Excalibur.Cdc.MongoDB
Assembly
Excalibur.Cdc.MongoDB.dll

Represents a data change event captured from MongoDB Change Streams.

public sealed class MongoDbDataChangeEvent
Inheritance
MongoDbDataChangeEvent
Inherited Members

Properties

ChangeType

Gets the type of change (Insert, Update, Replace, Delete, etc.).

public MongoDbDataChangeType ChangeType { get; init; }

Property Value

MongoDbDataChangeType

ClusterTime

Gets the cluster time when the change occurred.

public BsonTimestamp? ClusterTime { get; init; }

Property Value

BsonTimestamp

CollectionName

Gets the collection name where the change occurred.

public string CollectionName { get; init; }

Property Value

string

DatabaseName

Gets the database name where the change occurred.

public string DatabaseName { get; init; }

Property Value

string

DocumentKey

Gets the document key that identifies the affected document.

public BsonDocument? DocumentKey { get; init; }

Property Value

BsonDocument

Remarks

This typically contains the _id field of the document.

FullDocument

Gets the full document after the change (for insert, update with full document, or replace).

public BsonDocument? FullDocument { get; init; }

Property Value

BsonDocument

Remarks

Available when FullDocument option is enabled in the change stream.

FullDocumentBeforeChange

Gets the document as it was before the change (MongoDB 6.0+).

public BsonDocument? FullDocumentBeforeChange { get; init; }

Property Value

BsonDocument

Remarks

Available when FullDocumentBeforeChange option is enabled and the collection has change stream pre and post images enabled.

FullNamespace

Gets the fully qualified namespace (database.collection).

public string FullNamespace { get; }

Property Value

string

Position

Gets the resume token position of this change.

public MongoDbCdcPosition Position { get; init; }

Property Value

MongoDbCdcPosition

UpdateDescription

Gets the update description containing modified fields and removed fields.

public MongoDbUpdateDescription? UpdateDescription { get; init; }

Property Value

MongoDbUpdateDescription

Remarks

Only present for update operations.

WallTime

Gets the wall clock time when the change was recorded.

public DateTimeOffset? WallTime { get; init; }

Property Value

DateTimeOffset?

Methods

CreateDelete(MongoDbCdcPosition, string, string, BsonDocument?, BsonDocument?, BsonTimestamp?, DateTimeOffset?)

Creates a new instance for a delete operation.

public static MongoDbDataChangeEvent CreateDelete(MongoDbCdcPosition position, string databaseName, string collectionName, BsonDocument? documentKey, BsonDocument? fullDocumentBeforeChange, BsonTimestamp? clusterTime, DateTimeOffset? wallTime)

Parameters

position MongoDbCdcPosition
databaseName string
collectionName string
documentKey BsonDocument
fullDocumentBeforeChange BsonDocument
clusterTime BsonTimestamp
wallTime DateTimeOffset?

Returns

MongoDbDataChangeEvent

CreateDrop(MongoDbCdcPosition, string, string, BsonTimestamp?, DateTimeOffset?)

Creates a new instance for a drop operation.

public static MongoDbDataChangeEvent CreateDrop(MongoDbCdcPosition position, string databaseName, string collectionName, BsonTimestamp? clusterTime, DateTimeOffset? wallTime)

Parameters

position MongoDbCdcPosition
databaseName string
collectionName string
clusterTime BsonTimestamp
wallTime DateTimeOffset?

Returns

MongoDbDataChangeEvent

CreateInsert(MongoDbCdcPosition, string, string, BsonDocument?, BsonDocument?, BsonTimestamp?, DateTimeOffset?)

Creates a new instance for an insert operation.

public static MongoDbDataChangeEvent CreateInsert(MongoDbCdcPosition position, string databaseName, string collectionName, BsonDocument? documentKey, BsonDocument? fullDocument, BsonTimestamp? clusterTime, DateTimeOffset? wallTime)

Parameters

position MongoDbCdcPosition
databaseName string
collectionName string
documentKey BsonDocument
fullDocument BsonDocument
clusterTime BsonTimestamp
wallTime DateTimeOffset?

Returns

MongoDbDataChangeEvent

CreateInvalidate(MongoDbCdcPosition, BsonTimestamp?, DateTimeOffset?)

Creates a new instance for an invalidate operation.

public static MongoDbDataChangeEvent CreateInvalidate(MongoDbCdcPosition position, BsonTimestamp? clusterTime, DateTimeOffset? wallTime)

Parameters

position MongoDbCdcPosition
clusterTime BsonTimestamp
wallTime DateTimeOffset?

Returns

MongoDbDataChangeEvent

CreateReplace(MongoDbCdcPosition, string, string, BsonDocument?, BsonDocument?, BsonDocument?, BsonTimestamp?, DateTimeOffset?)

Creates a new instance for a replace operation.

public static MongoDbDataChangeEvent CreateReplace(MongoDbCdcPosition position, string databaseName, string collectionName, BsonDocument? documentKey, BsonDocument? fullDocument, BsonDocument? fullDocumentBeforeChange, BsonTimestamp? clusterTime, DateTimeOffset? wallTime)

Parameters

position MongoDbCdcPosition
databaseName string
collectionName string
documentKey BsonDocument
fullDocument BsonDocument
fullDocumentBeforeChange BsonDocument
clusterTime BsonTimestamp
wallTime DateTimeOffset?

Returns

MongoDbDataChangeEvent

CreateUpdate(MongoDbCdcPosition, string, string, BsonDocument?, BsonDocument?, BsonDocument?, MongoDbUpdateDescription?, BsonTimestamp?, DateTimeOffset?)

Creates a new instance for an update operation.

public static MongoDbDataChangeEvent CreateUpdate(MongoDbCdcPosition position, string databaseName, string collectionName, BsonDocument? documentKey, BsonDocument? fullDocument, BsonDocument? fullDocumentBeforeChange, MongoDbUpdateDescription? updateDescription, BsonTimestamp? clusterTime, DateTimeOffset? wallTime)

Parameters

position MongoDbCdcPosition
databaseName string
collectionName string
documentKey BsonDocument
fullDocument BsonDocument
fullDocumentBeforeChange BsonDocument
updateDescription MongoDbUpdateDescription
clusterTime BsonTimestamp
wallTime DateTimeOffset?

Returns

MongoDbDataChangeEvent