diff --git a/test/spec/change-streams/unified/change-streams-disambiguatedPaths.json b/test/spec/change-streams/unified/change-streams-disambiguatedPaths.json index a8667b5436c..8f041ecc0d7 100644 --- a/test/spec/change-streams/unified/change-streams-disambiguatedPaths.json +++ b/test/spec/change-streams/unified/change-streams-disambiguatedPaths.json @@ -42,6 +42,91 @@ } ], "tests": [ + { + "description": "disambiguatedPaths is not present when showExpandedEvents is false/unset", + "runOnRequirements": [ + { + "minServerVersion": "6.1.0", + "maxServerVersion": "8.1.99", + "topologies": [ + "replicaset", + "load-balanced", + "sharded" + ], + "serverless": "forbid" + }, + { + "minServerVersion": "8.2.1", + "topologies": [ + "replicaset", + "load-balanced", + "sharded" + ], + "serverless": "forbid" + } + ], + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1, + "a": { + "1": 1 + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$set": { + "a.1": 2 + } + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "update", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "updateDescription": { + "updatedFields": { + "$$exists": true + }, + "removedFields": { + "$$exists": true + }, + "truncatedArrays": { + "$$exists": true + }, + "disambiguatedPaths": { + "$$exists": false + } + } + } + } + ] + }, { "description": "disambiguatedPaths is present on updateDescription when an ambiguous path is present", "operations": [ @@ -184,4 +269,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/test/spec/change-streams/unified/change-streams-disambiguatedPaths.yml b/test/spec/change-streams/unified/change-streams-disambiguatedPaths.yml index acd05cec4dc..e35930d96af 100644 --- a/test/spec/change-streams/unified/change-streams-disambiguatedPaths.yml +++ b/test/spec/change-streams/unified/change-streams-disambiguatedPaths.yml @@ -15,7 +15,7 @@ createEntities: runOnRequirements: - minServerVersion: "6.1.0" - topologies: [ replicaset, sharded-replicaset, load-balanced, sharded ] + topologies: [ replicaset, load-balanced, sharded ] serverless: forbid initialData: @@ -24,6 +24,41 @@ initialData: documents: [] tests: + - description: "disambiguatedPaths is not present when showExpandedEvents is false/unset" + # skip server version 8.2.0, which emits disambiguatedPaths unconditionally + runOnRequirements: + - minServerVersion: "6.1.0" + maxServerVersion: "8.1.99" + topologies: [ replicaset, load-balanced, sharded ] + serverless: forbid + - minServerVersion: "8.2.1" + topologies: [ replicaset, load-balanced, sharded ] + serverless: forbid + operations: + - name: insertOne + object: *collection0 + arguments: + document: { _id: 1, 'a': { '1': 1 } } + - name: createChangeStream + object: *collection0 + arguments: { pipeline: [] } + saveResultAsEntity: &changeStream0 changeStream0 + - name: updateOne + object: *collection0 + arguments: + filter: { _id: 1 } + update: { $set: { 'a.1': 2 } } + - name: iterateUntilDocumentOrError + object: *changeStream0 + expectResult: + operationType: "update" + ns: { db: *database0, coll: *collection0 } + updateDescription: + updatedFields: { $$exists: true } + removedFields: { $$exists: true } + truncatedArrays: { $$exists: true } + disambiguatedPaths: { $$exists: false } + - description: "disambiguatedPaths is present on updateDescription when an ambiguous path is present" operations: - name: insertOne @@ -74,4 +109,4 @@ tests: updatedFields: { $$exists: true } removedFields: { $$exists: true } truncatedArrays: { $$exists: true } - disambiguatedPaths: { 'a.0.1': ['a', { $$type: 'int' }, '1'] } + disambiguatedPaths: { 'a.0.1': ['a', { $$type: 'int' }, '1'] } \ No newline at end of file