-
Notifications
You must be signed in to change notification settings - Fork 246
DRIVERS-2344: add disambiguatedPaths to change streams update document #1292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
72dc6ea
4c9b173
fcca0f8
2cd8cff
3023642
f898171
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,250 @@ | ||
| { | ||
| "description": "disambiguatedPaths", | ||
| "schemaVersion": "1.9", | ||
| "createEntities": [ | ||
| { | ||
| "client": { | ||
| "id": "client0", | ||
| "useMultipleMongoses": false | ||
| } | ||
| }, | ||
| { | ||
| "database": { | ||
| "id": "database0", | ||
| "client": "client0", | ||
| "databaseName": "database0" | ||
| } | ||
| }, | ||
| { | ||
| "collection": { | ||
| "id": "collection0", | ||
| "database": "database0", | ||
| "collectionName": "collection0" | ||
| } | ||
| } | ||
| ], | ||
| "runOnRequirements": [ | ||
| { | ||
| "minServerVersion": "6.1.0", | ||
| "topologies": [ | ||
| "replicaset", | ||
| "sharded-replicaset", | ||
| "load-balanced" | ||
| ] | ||
| } | ||
| ], | ||
| "initialData": [ | ||
| { | ||
| "collectionName": "collection0", | ||
| "databaseName": "database0", | ||
| "documents": [] | ||
| } | ||
| ], | ||
| "tests": [ | ||
| { | ||
| "description": "disambiguatedPaths is not present when showExpandedEvents is false/unset", | ||
| "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": [ | ||
| { | ||
| "name": "insertOne", | ||
| "object": "collection0", | ||
| "arguments": { | ||
| "document": { | ||
| "_id": 1, | ||
| "a": { | ||
| "1": 1 | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "name": "createChangeStream", | ||
| "object": "collection0", | ||
| "arguments": { | ||
| "pipeline": [], | ||
| "showExpandedEvents": true | ||
| }, | ||
| "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": { | ||
| "a.1": [ | ||
| "a", | ||
| "1" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "description": "disambiguatedPaths returns array indices as integers", | ||
| "operations": [ | ||
| { | ||
| "name": "insertOne", | ||
| "object": "collection0", | ||
| "arguments": { | ||
| "document": { | ||
| "_id": 1, | ||
| "a": [ | ||
| { | ||
| "1": 1 | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "name": "createChangeStream", | ||
| "object": "collection0", | ||
| "arguments": { | ||
| "pipeline": [], | ||
| "showExpandedEvents": true | ||
| }, | ||
| "saveResultAsEntity": "changeStream0" | ||
| }, | ||
| { | ||
| "name": "updateOne", | ||
| "object": "collection0", | ||
| "arguments": { | ||
| "filter": { | ||
| "_id": 1 | ||
| }, | ||
| "update": { | ||
| "$set": { | ||
| "a.0.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": { | ||
| "a.0.1": [ | ||
| "a", | ||
| { | ||
| "$$type": "int" | ||
| }, | ||
| "1" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| description: "disambiguatedPaths" | ||
| schemaVersion: "1.9" | ||
|
benjirewis marked this conversation as resolved.
Outdated
|
||
| createEntities: | ||
| - client: | ||
| id: &client0 client0 | ||
| useMultipleMongoses: false | ||
| - database: | ||
| id: &database0 database0 | ||
| client: *client0 | ||
| databaseName: *database0 | ||
| - collection: | ||
| id: &collection0 collection0 | ||
| database: *database0 | ||
| collectionName: *collection0 | ||
|
|
||
| runOnRequirements: | ||
| - minServerVersion: "6.1.0" | ||
| topologies: [ replicaset, sharded-replicaset, load-balanced ] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do these new tests pass on sharded clusters + serverless? I would hope so, but we've had issues in the past with change streams tests on those topologies.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They pass on sharded replica sets - https://evergreen.mongodb.com/task_log_raw/mongo_node_driver_next_ubuntu_18.04_erbium_test_latest_sharded_cluster_patch_f28ba0de3bc925267a185965eb971ecf91bc2680_62fd236be3c3313be42d354a_22_08_17_17_20_44/0?type=T#L835 Sharded is odd because sharded clusters must be backed by replica sets as of 3.6 (https://www.mongodb.com/docs/manual/core/sharded-cluster-components/#sharded-cluster-components). So effectively they're the same now, I can add it as well to the list of topologies.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The spec says:
Thanks for adding |
||
|
|
||
| initialData: | ||
| - collectionName: *collection0 | ||
| databaseName: *database0 | ||
| documents: [] | ||
|
|
||
| tests: | ||
| - description: "disambiguatedPaths is not present when showExpandedEvents is false/unset" | ||
| operations: | ||
| - name: insertOne | ||
| object: *collection0 | ||
| arguments: | ||
| document: { _id: 1, 'a': { '1': 1 } } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [opt] You could use |
||
| - 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 | ||
| object: *collection0 | ||
| arguments: | ||
| document: { _id: 1, 'a': { '1': 1 } } | ||
| - name: createChangeStream | ||
| object: *collection0 | ||
| arguments: { pipeline: [], showExpandedEvents: true } | ||
| 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: { 'a.1': ['a', '1'] } | ||
|
|
||
| - description: "disambiguatedPaths returns array indices as integers" | ||
| operations: | ||
| - name: insertOne | ||
| object: *collection0 | ||
| arguments: | ||
| document: { _id: 1, 'a': [{'1': 1 }] } | ||
| - name: createChangeStream | ||
| object: *collection0 | ||
| arguments: { pipeline: [], showExpandedEvents: true } | ||
| saveResultAsEntity: &changeStream0 changeStream0 | ||
| - name: updateOne | ||
| object: *collection0 | ||
| arguments: | ||
| filter: { _id: 1 } | ||
| update: { $set: { 'a.0.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: { 'a.0.1': ['a', { $$type: 'int' }, '1'] } | ||
Uh oh!
There was an error while loading. Please reload this page.