-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(NODE-5988): Provide access to raw results doc on MongoServerError (
- Loading branch information
1 parent
69de253
commit c023242
Showing
26 changed files
with
1,234 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
test/spec/collection-management/modifyCollection-errorResponse.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
{ | ||
"description": "modifyCollection-errorResponse", | ||
"schemaVersion": "1.12", | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0", | ||
"observeEvents": [ | ||
"commandStartedEvent" | ||
] | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database0", | ||
"client": "client0", | ||
"databaseName": "collMod-tests" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection0", | ||
"database": "database0", | ||
"collectionName": "test" | ||
} | ||
} | ||
], | ||
"initialData": [ | ||
{ | ||
"collectionName": "test", | ||
"databaseName": "collMod-tests", | ||
"documents": [ | ||
{ | ||
"_id": 1, | ||
"x": 1 | ||
}, | ||
{ | ||
"_id": 2, | ||
"x": 1 | ||
} | ||
] | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "modifyCollection prepareUnique violations are accessible", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "5.2" | ||
} | ||
], | ||
"operations": [ | ||
{ | ||
"name": "createIndex", | ||
"object": "collection0", | ||
"arguments": { | ||
"keys": { | ||
"x": 1 | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "modifyCollection", | ||
"object": "database0", | ||
"arguments": { | ||
"collection": "test", | ||
"index": { | ||
"keyPattern": { | ||
"x": 1 | ||
}, | ||
"prepareUnique": true | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "insertOne", | ||
"object": "collection0", | ||
"arguments": { | ||
"document": { | ||
"_id": 3, | ||
"x": 1 | ||
} | ||
}, | ||
"expectError": { | ||
"errorCode": 11000 | ||
} | ||
}, | ||
{ | ||
"name": "modifyCollection", | ||
"object": "database0", | ||
"arguments": { | ||
"collection": "test", | ||
"index": { | ||
"keyPattern": { | ||
"x": 1 | ||
}, | ||
"unique": true | ||
} | ||
}, | ||
"expectError": { | ||
"isClientError": false, | ||
"errorCode": 359, | ||
"errorResponse": { | ||
"violations": [ | ||
{ | ||
"ids": [ | ||
1, | ||
2 | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
59 changes: 59 additions & 0 deletions
59
test/spec/collection-management/modifyCollection-errorResponse.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
description: "modifyCollection-errorResponse" | ||
|
||
schemaVersion: "1.12" | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
observeEvents: [ commandStartedEvent ] | ||
- database: | ||
id: &database0 database0 | ||
client: *client0 | ||
databaseName: &database0Name collMod-tests | ||
- collection: | ||
id: &collection0 collection0 | ||
database: *database0 | ||
collectionName: &collection0Name test | ||
|
||
initialData: &initialData | ||
- collectionName: *collection0Name | ||
databaseName: *database0Name | ||
documents: | ||
- { _id: 1, x: 1 } | ||
- { _id: 2, x: 1 } | ||
|
||
tests: | ||
- description: "modifyCollection prepareUnique violations are accessible" | ||
runOnRequirements: | ||
- minServerVersion: "5.2" # SERVER-61158 | ||
operations: | ||
- name: createIndex | ||
object: *collection0 | ||
arguments: | ||
keys: { x: 1 } | ||
- name: modifyCollection | ||
object: *database0 | ||
arguments: | ||
collection: *collection0Name | ||
index: | ||
keyPattern: { x: 1 } | ||
prepareUnique: true | ||
- name: insertOne | ||
object: *collection0 | ||
arguments: | ||
document: { _id: 3, x: 1 } | ||
expectError: | ||
errorCode: 11000 # DuplicateKey | ||
- name: modifyCollection | ||
object: *database0 | ||
arguments: | ||
collection: *collection0Name | ||
index: | ||
keyPattern: { x: 1 } | ||
unique: true | ||
expectError: | ||
isClientError: false | ||
errorCode: 359 # CannotConvertIndexToUnique | ||
errorResponse: | ||
violations: | ||
- { ids: [ 1, 2 ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"description": "aggregate-merge-errorResponse", | ||
"schemaVersion": "1.12", | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0" | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database0", | ||
"client": "client0", | ||
"databaseName": "crud-tests" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection0", | ||
"database": "database0", | ||
"collectionName": "test" | ||
} | ||
} | ||
], | ||
"initialData": [ | ||
{ | ||
"collectionName": "test", | ||
"databaseName": "crud-tests", | ||
"documents": [ | ||
{ | ||
"_id": 1, | ||
"x": 1 | ||
}, | ||
{ | ||
"_id": 2, | ||
"x": 1 | ||
} | ||
] | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "aggregate $merge DuplicateKey error is accessible", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "5.1", | ||
"topologies": [ | ||
"single", | ||
"replicaset" | ||
] | ||
} | ||
], | ||
"operations": [ | ||
{ | ||
"name": "aggregate", | ||
"object": "database0", | ||
"arguments": { | ||
"pipeline": [ | ||
{ | ||
"$documents": [ | ||
{ | ||
"_id": 2, | ||
"x": 1 | ||
} | ||
] | ||
}, | ||
{ | ||
"$merge": { | ||
"into": "test", | ||
"whenMatched": "fail" | ||
} | ||
} | ||
] | ||
}, | ||
"expectError": { | ||
"errorCode": 11000, | ||
"errorResponse": { | ||
"keyPattern": { | ||
"_id": 1 | ||
}, | ||
"keyValue": { | ||
"_id": 2 | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.