| 1 | { |
| 2 | "description": "findOneAndReplace-hint-unacknowledged", |
| 3 | "schemaVersion": "1.0", |
| 4 | "createEntities": [ |
| 5 | { |
| 6 | "client": { |
| 7 | "id": "client0", |
| 8 | "observeEvents": [ |
| 9 | "commandStartedEvent" |
| 10 | ] |
| 11 | } |
| 12 | }, |
| 13 | { |
| 14 | "database": { |
| 15 | "id": "database0", |
| 16 | "client": "client0", |
| 17 | "databaseName": "db0" |
| 18 | } |
| 19 | }, |
| 20 | { |
| 21 | "collection": { |
| 22 | "id": "collection0", |
| 23 | "database": "database0", |
| 24 | "collectionName": "coll0", |
| 25 | "collectionOptions": { |
| 26 | "writeConcern": { |
| 27 | "w": 0 |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | }, |
| 32 | { |
| 33 | "collection": { |
| 34 | "id": "collection1", |
| 35 | "database": "database0", |
| 36 | "collectionName": "coll0" |
| 37 | } |
| 38 | } |
| 39 | ], |
| 40 | "initialData": [ |
| 41 | { |
| 42 | "collectionName": "coll0", |
| 43 | "databaseName": "db0", |
| 44 | "documents": [ |
| 45 | { |
| 46 | "_id": 1, |
| 47 | "x": 11 |
| 48 | }, |
| 49 | { |
| 50 | "_id": 2, |
| 51 | "x": 22 |
| 52 | } |
| 53 | ] |
| 54 | } |
| 55 | ], |
| 56 | "tests": [ |
| 57 | { |
| 58 | "description": "Unacknowledged findOneAndReplace with hint string fails with client-side error on pre-4.4 server", |
| 59 | "runOnRequirements": [ |
| 60 | { |
| 61 | "maxServerVersion": "4.2.99" |
| 62 | } |
| 63 | ], |
| 64 | "operations": [ |
| 65 | { |
| 66 | "object": "collection0", |
| 67 | "name": "findOneAndReplace", |
| 68 | "arguments": { |
| 69 | "filter": { |
| 70 | "_id": { |
| 71 | "$gt": 1 |
| 72 | } |
| 73 | }, |
| 74 | "replacement": { |
| 75 | "x": 111 |
| 76 | }, |
| 77 | "hint": "_id_" |
| 78 | }, |
| 79 | "expectError": { |
| 80 | "isClientError": true |
| 81 | } |
| 82 | } |
| 83 | ], |
| 84 | "expectEvents": [ |
| 85 | { |
| 86 | "client": "client0", |
| 87 | "events": [] |
| 88 | } |
| 89 | ] |
| 90 | }, |
| 91 | { |
| 92 | "description": "Unacknowledged findOneAndReplace with hint document fails with client-side error on pre-4.4 server", |
| 93 | "runOnRequirements": [ |
| 94 | { |
| 95 | "maxServerVersion": "4.2.99" |
| 96 | } |
| 97 | ], |
| 98 | "operations": [ |
| 99 | { |
| 100 | "object": "collection0", |
| 101 | "name": "findOneAndReplace", |
| 102 | "arguments": { |
| 103 | "filter": { |
| 104 | "_id": { |
| 105 | "$gt": 1 |
| 106 | } |
| 107 | }, |
| 108 | "replacement": { |
| 109 | "x": 111 |
| 110 | }, |
| 111 | "hint": { |
| 112 | "_id": 1 |
| 113 | } |
| 114 | }, |
| 115 | "expectError": { |
| 116 | "isClientError": true |
| 117 | } |
| 118 | } |
| 119 | ], |
| 120 | "expectEvents": [ |
| 121 | { |
| 122 | "client": "client0", |
| 123 | "events": [] |
| 124 | } |
| 125 | ] |
| 126 | }, |
| 127 | { |
| 128 | "description": "Unacknowledged findOneAndReplace with hint string on 4.4+ server", |
| 129 | "runOnRequirements": [ |
| 130 | { |
| 131 | "minServerVersion": "4.4.0" |
| 132 | } |
| 133 | ], |
| 134 | "operations": [ |
| 135 | { |
| 136 | "object": "collection0", |
| 137 | "name": "findOneAndReplace", |
| 138 | "arguments": { |
| 139 | "filter": { |
| 140 | "_id": { |
| 141 | "$gt": 1 |
| 142 | } |
| 143 | }, |
| 144 | "replacement": { |
| 145 | "x": 111 |
| 146 | }, |
| 147 | "hint": "_id_" |
| 148 | }, |
| 149 | "expectResult": { |
| 150 | "$$unsetOrMatches": null |
| 151 | } |
| 152 | } |
| 153 | ], |
| 154 | "expectEvents": [ |
| 155 | { |
| 156 | "client": "client0", |
| 157 | "events": [ |
| 158 | { |
| 159 | "commandStartedEvent": { |
| 160 | "command": { |
| 161 | "findAndModify": "coll0", |
| 162 | "query": { |
| 163 | "_id": { |
| 164 | "$gt": 1 |
| 165 | } |
| 166 | }, |
| 167 | "update": { |
| 168 | "x": 111 |
| 169 | }, |
| 170 | "hint": { |
| 171 | "$$type": [ |
| 172 | "string", |
| 173 | "object" |
| 174 | ] |
| 175 | }, |
| 176 | "writeConcern": { |
| 177 | "w": 0 |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | ] |
| 183 | } |
| 184 | ] |
| 185 | }, |
| 186 | { |
| 187 | "description": "Unacknowledged findOneAndReplace with hint document on 4.4+ server", |
| 188 | "runOnRequirements": [ |
| 189 | { |
| 190 | "minServerVersion": "4.4.0" |
| 191 | } |
| 192 | ], |
| 193 | "operations": [ |
| 194 | { |
| 195 | "object": "collection0", |
| 196 | "name": "findOneAndReplace", |
| 197 | "arguments": { |
| 198 | "filter": { |
| 199 | "_id": { |
| 200 | "$gt": 1 |
| 201 | } |
| 202 | }, |
| 203 | "replacement": { |
| 204 | "x": 111 |
| 205 | }, |
| 206 | "hint": { |
| 207 | "_id": 1 |
| 208 | } |
| 209 | }, |
| 210 | "expectResult": { |
| 211 | "$$unsetOrMatches": null |
| 212 | } |
| 213 | } |
| 214 | ], |
| 215 | "expectEvents": [ |
| 216 | { |
| 217 | "client": "client0", |
| 218 | "events": [ |
| 219 | { |
| 220 | "commandStartedEvent": { |
| 221 | "command": { |
| 222 | "findAndModify": "coll0", |
| 223 | "query": { |
| 224 | "_id": { |
| 225 | "$gt": 1 |
| 226 | } |
| 227 | }, |
| 228 | "update": { |
| 229 | "x": 111 |
| 230 | }, |
| 231 | "hint": { |
| 232 | "$$type": [ |
| 233 | "string", |
| 234 | "object" |
| 235 | ] |
| 236 | }, |
| 237 | "writeConcern": { |
| 238 | "w": 0 |
| 239 | } |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | ] |
| 244 | } |
| 245 | ] |
| 246 | } |
| 247 | ] |
| 248 | } |