| 1 |
{ |
| 2 |
"description": "updateOne", |
| 3 |
"schemaVersion": "1.0", |
| 4 |
"createEntities": [ |
| 5 |
{ |
| 6 |
"client": { |
| 7 |
"id": "client", |
| 8 |
"observeEvents": [ |
| 9 |
"commandStartedEvent", |
| 10 |
"commandSucceededEvent", |
| 11 |
"commandFailedEvent" |
| 12 |
] |
| 13 |
} |
| 14 |
}, |
| 15 |
{ |
| 16 |
"database": { |
| 17 |
"id": "database", |
| 18 |
"client": "client", |
| 19 |
"databaseName": "command-monitoring-tests" |
| 20 |
} |
| 21 |
}, |
| 22 |
{ |
| 23 |
"collection": { |
| 24 |
"id": "collection", |
| 25 |
"database": "database", |
| 26 |
"collectionName": "test" |
| 27 |
} |
| 28 |
} |
| 29 |
], |
| 30 |
"initialData": [ |
| 31 |
{ |
| 32 |
"collectionName": "test", |
| 33 |
"databaseName": "command-monitoring-tests", |
| 34 |
"documents": [ |
| 35 |
{ |
| 36 |
"_id": 1, |
| 37 |
"x": 11 |
| 38 |
}, |
| 39 |
{ |
| 40 |
"_id": 2, |
| 41 |
"x": 22 |
| 42 |
}, |
| 43 |
{ |
| 44 |
"_id": 3, |
| 45 |
"x": 33 |
| 46 |
} |
| 47 |
] |
| 48 |
} |
| 49 |
], |
| 50 |
"tests": [ |
| 51 |
{ |
| 52 |
"description": "A successful updateOne", |
| 53 |
"operations": [ |
| 54 |
{ |
| 55 |
"name": "updateOne", |
| 56 |
"object": "collection", |
| 57 |
"arguments": { |
| 58 |
"filter": { |
| 59 |
"_id": { |
| 60 |
"$gt": 1 |
| 61 |
} |
| 62 |
}, |
| 63 |
"update": { |
| 64 |
"$inc": { |
| 65 |
"x": 1 |
| 66 |
} |
| 67 |
} |
| 68 |
} |
| 69 |
} |
| 70 |
], |
| 71 |
"expectEvents": [ |
| 72 |
{ |
| 73 |
"client": "client", |
| 74 |
"events": [ |
| 75 |
{ |
| 76 |
"commandStartedEvent": { |
| 77 |
"command": { |
| 78 |
"update": "test", |
| 79 |
"updates": [ |
| 80 |
{ |
| 81 |
"q": { |
| 82 |
"_id": { |
| 83 |
"$gt": 1 |
| 84 |
} |
| 85 |
}, |
| 86 |
"u": { |
| 87 |
"$inc": { |
| 88 |
"x": 1 |
| 89 |
} |
| 90 |
}, |
| 91 |
"upsert": { |
| 92 |
"$$unsetOrMatches": false |
| 93 |
}, |
| 94 |
"multi": { |
| 95 |
"$$unsetOrMatches": false |
| 96 |
} |
| 97 |
} |
| 98 |
], |
| 99 |
"ordered": true |
| 100 |
}, |
| 101 |
"commandName": "update", |
| 102 |
"databaseName": "command-monitoring-tests" |
| 103 |
} |
| 104 |
}, |
| 105 |
{ |
| 106 |
"commandSucceededEvent": { |
| 107 |
"reply": { |
| 108 |
"ok": 1, |
| 109 |
"n": 1 |
| 110 |
}, |
| 111 |
"commandName": "update" |
| 112 |
} |
| 113 |
} |
| 114 |
] |
| 115 |
} |
| 116 |
] |
| 117 |
}, |
| 118 |
{ |
| 119 |
"description": "A successful updateOne with upsert where the upserted id is not an ObjectId", |
| 120 |
"operations": [ |
| 121 |
{ |
| 122 |
"name": "updateOne", |
| 123 |
"object": "collection", |
| 124 |
"arguments": { |
| 125 |
"filter": { |
| 126 |
"_id": 4 |
| 127 |
}, |
| 128 |
"update": { |
| 129 |
"$inc": { |
| 130 |
"x": 1 |
| 131 |
} |
| 132 |
}, |
| 133 |
"upsert": true |
| 134 |
} |
| 135 |
} |
| 136 |
], |
| 137 |
"expectEvents": [ |
| 138 |
{ |
| 139 |
"client": "client", |
| 140 |
"events": [ |
| 141 |
{ |
| 142 |
"commandStartedEvent": { |
| 143 |
"command": { |
| 144 |
"update": "test", |
| 145 |
"updates": [ |
| 146 |
{ |
| 147 |
"q": { |
| 148 |
"_id": 4 |
| 149 |
}, |
| 150 |
"u": { |
| 151 |
"$inc": { |
| 152 |
"x": 1 |
| 153 |
} |
| 154 |
}, |
| 155 |
"upsert": true, |
| 156 |
"multi": { |
| 157 |
"$$unsetOrMatches": false |
| 158 |
} |
| 159 |
} |
| 160 |
], |
| 161 |
"ordered": true |
| 162 |
}, |
| 163 |
"commandName": "update", |
| 164 |
"databaseName": "command-monitoring-tests" |
| 165 |
} |
| 166 |
}, |
| 167 |
{ |
| 168 |
"commandSucceededEvent": { |
| 169 |
"reply": { |
| 170 |
"ok": 1, |
| 171 |
"n": 1, |
| 172 |
"upserted": [ |
| 173 |
{ |
| 174 |
"index": 0, |
| 175 |
"_id": 4 |
| 176 |
} |
| 177 |
] |
| 178 |
}, |
| 179 |
"commandName": "update" |
| 180 |
} |
| 181 |
} |
| 182 |
] |
| 183 |
} |
| 184 |
] |
| 185 |
}, |
| 186 |
{ |
| 187 |
"description": "A successful updateOne with write errors", |
| 188 |
"operations": [ |
| 189 |
{ |
| 190 |
"name": "updateOne", |
| 191 |
"object": "collection", |
| 192 |
"arguments": { |
| 193 |
"filter": { |
| 194 |
"_id": { |
| 195 |
"$gt": 1 |
| 196 |
} |
| 197 |
}, |
| 198 |
"update": { |
| 199 |
"$unsupported": { |
| 200 |
"x": 1 |
| 201 |
} |
| 202 |
} |
| 203 |
}, |
| 204 |
"expectError": { |
| 205 |
"isClientError": false |
| 206 |
} |
| 207 |
} |
| 208 |
], |
| 209 |
"expectEvents": [ |
| 210 |
{ |
| 211 |
"client": "client", |
| 212 |
"events": [ |
| 213 |
{ |
| 214 |
"commandStartedEvent": { |
| 215 |
"command": { |
| 216 |
"update": "test", |
| 217 |
"updates": [ |
| 218 |
{ |
| 219 |
"q": { |
| 220 |
"_id": { |
| 221 |
"$gt": 1 |
| 222 |
} |
| 223 |
}, |
| 224 |
"u": { |
| 225 |
"$unsupported": { |
| 226 |
"x": 1 |
| 227 |
} |
| 228 |
}, |
| 229 |
"upsert": { |
| 230 |
"$$unsetOrMatches": false |
| 231 |
}, |
| 232 |
"multi": { |
| 233 |
"$$unsetOrMatches": false |
| 234 |
} |
| 235 |
} |
| 236 |
], |
| 237 |
"ordered": true |
| 238 |
}, |
| 239 |
"commandName": "update", |
| 240 |
"databaseName": "command-monitoring-tests" |
| 241 |
} |
| 242 |
}, |
| 243 |
{ |
| 244 |
"commandSucceededEvent": { |
| 245 |
"reply": { |
| 246 |
"ok": 1, |
| 247 |
"n": 0, |
| 248 |
"writeErrors": { |
| 249 |
"$$type": "array" |
| 250 |
} |
| 251 |
}, |
| 252 |
"commandName": "update" |
| 253 |
} |
| 254 |
} |
| 255 |
] |
| 256 |
} |
| 257 |
] |
| 258 |
} |
| 259 |
] |
| 260 |
} |