Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions source/change-streams/change-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ class ChangeStreamDocument {
*/
clusterTime: Timestamp;

/**
* When this operation was committed.
* Only present for events in a transaction and only when the `showExpandedEvents` change stream option is enabled.
*/
commitTimestamp: Optional<Timestamp>;

}

class UpdateDescription {
Expand Down Expand Up @@ -1026,6 +1032,8 @@ There should be no backwards compatibility concerns.

## Changelog

- 2026-01-30: Add `commitTimestamp` to `ChangeStreamDocument`.

- 2025-09-08: Clarify resume behavior.

- 2025-03-31: Update for expanded field visibility in server 8.2+
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
description: "change-streams-commitTimestamp"
schemaVersion: "1.7"
runOnRequirements:
- minServerVersion: "8.2.0"
topologies: [ replicaset, sharded ]
serverless: forbid

createEntities:
- client:
id: &client0 client0
- database:
id: &database0 database0
client: *client0
databaseName: *database0
- collection:
id: &collection0 collection0
database: *database0
collectionName: *collection0
- session:
id: &session0 session0
client: *client0

initialData:
- collectionName: *collection0
databaseName: *database0
documents: []

tests:
- description: "when showExpandedEvents is true, commitTimestamp is included for operations in a transaction"
operations:
- name: createChangeStream
object: *collection0
arguments:
pipeline: []
showExpandedEvents: true
saveResultAsEntity: &changeStream0 changeStream0
- name: startTransaction
object: *session0
- name: insertOne
object: *collection0
arguments:
document: { x: 1 }
session: *session0
- name: commitTransaction
object: *session0
- name: iterateUntilDocumentOrError
object: *changeStream0
expectResult:
operationType: insert
ns:
db: *database0
coll: *collection0
commitTimestamp: { $$exists: true }
- name: insertOne
object: *collection0
arguments:
document: { x: 1 }
- name: iterateUntilDocumentOrError
object: *changeStream0
expectResult:
operationType: insert
ns:
db: *database0
coll: *collection0
commitTimestamp: { $$exists: false }
Loading