Querying changes

This feature has been released as a public beta in AuraDB Enterprise October Release and Neo4j Enterprise Edition 5.13 and breaking changes are likely to be introduced before it is made generally available (GA).

The procedure cdc.query is used to query the database for captured changes. Once all changes have been streamed the query terminates.

Since the transaction logs get pruned regularly, changes are only available for querying as long as they have not been pruned. See Operations Manual → Configuration → Transaction Log for more details.

Changes also stop being available if enrichment mode is disabled. Even if enabled again, it is not possible to query the previous change records.

    from =  :: STRING?, (1)
    selectors = [] :: LIST? OF MAP? (2)
) :: (
    id :: STRING?, (3)
    txId :: INTEGER?, (4)
    seq :: INTEGER?, (5)
    metadata :: MAP?, (6)
    event :: MAP? (7)
1 The change identifier, either captured from an earlier call to cdc.query or from one of cdc.current or cdc.earliest, to query the captured changes from. Default value is "" (empty string) which is replaced with cdc.current implicitly. This value is treated as exclusive and the results of the query do not include the change corresponding to this value. To get a from value for the first iteration, see cdc.current and cdc.earliest.
2 An optional list of selectors that could be used to filter out changes. Default is an empty list, which means all changes are returned without any filtering taking place. See selectors for details.
3 A unique change identifier that identifies each change record. Used as a cursor to continue querying changes from last processed change.
4 A number identifying which transaction the change happened in, unique in combination with seq. Transaction identifiers are not continuous. Some transactions, such as system and schema commands, are not recorded in change data capture and cause gaps in the transaction identifiers.
5 A number used for ordering changes happened in the same transaction. Note that the order of changes observed in the output does not necessarily correspond to the order of changes applied during the transaction.
6 A map of values that contain metadata information about the transaction. This is the same for all of the changes in a single transaction. For a detailed description of metadata fields, see Change event schema.
7 A set of information describing the change on the entity. For a detailed description of change event, see Change event schema.
Query for changes
Table 1. Result
id txId seq metadata event




{executingUser: "neo4j", connectionClient: "", authenticatedUser: "neo4j", captureMode: "DIFF", serverId: "4c453340", databaseId: ""edec6ba8-e82f-4aac-ae41-2725f2357fdd", connectionType: "bolt", connectionServer: "", txStartTime: 2023-04-25T07:50:10.250Z, txCommitTime: 2023-04-25T07:50:10.305Z}

{elementId: "4:7575e996-8b95-49a7-8a91-cb1645ab940d:0", keys: {}, eventType: "n", state: {before: NULL, after: {properties: {}, labels: []}}, operation: "c", labels: []}

Rows: 1

For a full description of change record schema, see Change event schema.