collection_name: &collection_name "test" database_name: &database_name "change-stream-tests" collection2_name: &collection2_name "test2" database2_name: &database2_name "change-stream-tests-2" tests: - description: "$changeStream must be the first stage in a change stream pipeline sent to the server" minServerVersion: "3.6.0" target: collection topology: - replicaset changeStreamPipeline: [] changeStreamOptions: {} operations: - database: *database_name collection: *collection_name name: insertOne arguments: document: x: 1 expectations: - command_started_event: command: aggregate: *collection_name cursor: {} pipeline: - $changeStream: fullDocument: default command_name: aggregate database_name: *database_name result: success: [] - description: The server returns change stream responses in the specified server response format minServerVersion: "3.6.0" target: collection topology: - replicaset changeStreamPipeline: [] changeStreamOptions: {} operations: - database: *database_name collection: *collection_name name: insertOne arguments: document: x: 1 expectations: [] result: success: - _id: "42" documentKey: "42" operationType: insert ns: db: *database_name coll: *collection_name fullDocument: x: $numberInt: "1" - description: Executing a watch helper on a Collection results in notifications for changes to the specified collection minServerVersion: "3.6.0" target: collection topology: - replicaset changeStreamPipeline: [] changeStreamOptions: {} operations: - database: *database_name collection: *collection2_name name: insertOne arguments: document: x: 1 - database: *database2_name collection: *collection_name name: insertOne arguments: document: y: 2 - database: *database_name collection: *collection_name name: insertOne arguments: document: z: 3 expectations: - command_started_event: command: aggregate: *collection_name cursor: {} pipeline: - $changeStream: fullDocument: default command_name: aggregate database_name: *database_name result: success: - operationType: insert ns: db: *database_name coll: *collection_name fullDocument: z: $numberInt: "3" - description: Change Stream should allow valid aggregate pipeline stages minServerVersion: "3.6.0" target: collection topology: - replicaset changeStreamPipeline: - $match: "fullDocument.z": 3 changeStreamOptions: {} operations: - database: *database_name collection: *collection_name name: insertOne arguments: document: y: 2 - database: *database_name collection: *collection_name name: insertOne arguments: document: z: 3 expectations: - command_started_event: command: aggregate: *collection_name cursor: {} pipeline: - $changeStream: fullDocument: default - $match: "fullDocument.z": $numberInt: "3" command_name: aggregate database_name: *database_name result: success: - operationType: insert ns: db: *database_name coll: *collection_name fullDocument: z: $numberInt: "3" - description: Executing a watch helper on a Database results in notifications for changes to all collections in the specified database. minServerVersion: "3.8.0" target: database topology: - replicaset changeStreamPipeline: [] changeStreamOptions: {} operations: - database: *database_name collection: *collection2_name name: insertOne arguments: document: x: 1 - database: *database2_name collection: *collection_name name: insertOne arguments: document: y: 2 - database: *database_name collection: *collection_name name: insertOne arguments: document: z: 3 expectations: - command_started_event: command: aggregate: $numberInt: "1" cursor: {} pipeline: - $changeStream: fullDocument: default command_name: aggregate database_name: *database_name result: success: - operationType: insert ns: db: *database_name coll: *collection2_name fullDocument: x: $numberInt: "1" - operationType: insert ns: db: *database_name coll: *collection_name fullDocument: z: $numberInt: "3" - description: Executing a watch helper on a MongoClient results in notifications for changes to all collections in all databases in the cluster. minServerVersion: "3.8.0" target: client topology: - replicaset changeStreamPipeline: [] changeStreamOptions: {} operations: - database: *database_name collection: *collection2_name name: insertOne arguments: document: x: 1 - database: *database2_name collection: *collection_name name: insertOne arguments: document: y: 2 - database: *database_name collection: *collection_name name: insertOne arguments: document: z: 3 expectations: - command_started_event: command: aggregate: $numberInt: "1" cursor: {} pipeline: - $changeStream: fullDocument: default allChangesForCluster: true command_name: aggregate database_name: admin result: success: - operationType: insert ns: db: *database_name coll: *collection2_name fullDocument: x: $numberInt: "1" - operationType: insert ns: db: *database2_name coll: *collection_name fullDocument: y: $numberInt: "2" - operationType: insert ns: db: *database_name coll: *collection_name fullDocument: z: $numberInt: "3"