| 1 |
description: "modifyCollection-errorResponse" |
| 2 |
|
| 3 |
schemaVersion: "1.12" |
| 4 |
|
| 5 |
createEntities: |
| 6 |
- client: |
| 7 |
id: &client0 client0 |
| 8 |
observeEvents: [ commandStartedEvent ] |
| 9 |
- database: |
| 10 |
id: &database0 database0 |
| 11 |
client: *client0 |
| 12 |
databaseName: &database0Name collMod-tests |
| 13 |
- collection: |
| 14 |
id: &collection0 collection0 |
| 15 |
database: *database0 |
| 16 |
collectionName: &collection0Name test |
| 17 |
|
| 18 |
initialData: &initialData |
| 19 |
- collectionName: *collection0Name |
| 20 |
databaseName: *database0Name |
| 21 |
documents: |
| 22 |
- { _id: 1, x: 1 } |
| 23 |
- { _id: 2, x: 1 } |
| 24 |
|
| 25 |
tests: |
| 26 |
- description: "modifyCollection prepareUnique violations are accessible" |
| 27 |
runOnRequirements: |
| 28 |
- minServerVersion: "5.2" # SERVER-61158 |
| 29 |
operations: |
| 30 |
- name: createIndex |
| 31 |
object: *collection0 |
| 32 |
arguments: |
| 33 |
keys: { x: 1 } |
| 34 |
- name: modifyCollection |
| 35 |
object: *database0 |
| 36 |
arguments: |
| 37 |
collection: *collection0Name |
| 38 |
index: |
| 39 |
keyPattern: { x: 1 } |
| 40 |
prepareUnique: true |
| 41 |
- name: insertOne |
| 42 |
object: *collection0 |
| 43 |
arguments: |
| 44 |
document: { _id: 3, x: 1 } |
| 45 |
expectError: |
| 46 |
errorCode: 11000 # DuplicateKey |
| 47 |
- name: modifyCollection |
| 48 |
object: *database0 |
| 49 |
arguments: |
| 50 |
collection: *collection0Name |
| 51 |
index: |
| 52 |
keyPattern: { x: 1 } |
| 53 |
unique: true |
| 54 |
expectError: |
| 55 |
isClientError: false |
| 56 |
errorCode: 359 # CannotConvertIndexToUnique |
| 57 |
errorResponse: |
| 58 |
violations: |
| 59 |
- { ids: [ 1, 2 ] } |