| 1 |
description: "change-streams" |
| 2 |
|
| 3 |
schemaVersion: "1.7" |
| 4 |
|
| 5 |
runOnRequirements: |
| 6 |
- minServerVersion: "3.6" |
| 7 |
|
| 8 |
|
| 9 |
topologies: [ replicaset ] |
| 10 |
serverless: forbid |
| 11 |
|
| 12 |
createEntities: |
| 13 |
- client: |
| 14 |
id: &client0 client0 |
| 15 |
observeEvents: [ commandStartedEvent ] |
| 16 |
ignoreCommandMonitoringEvents: [ killCursors ] |
| 17 |
useMultipleMongoses: false |
| 18 |
- client: |
| 19 |
id: &globalClient globalClient |
| 20 |
useMultipleMongoses: false |
| 21 |
- database: |
| 22 |
id: &database0 database0 |
| 23 |
client: *client0 |
| 24 |
databaseName: *database0 |
| 25 |
- collection: |
| 26 |
id: &collection0 collection0 |
| 27 |
database: *database0 |
| 28 |
collectionName: *collection0 |
| 29 |
- database: |
| 30 |
id: &database1 database1 |
| 31 |
client: *client0 |
| 32 |
databaseName: *database1 |
| 33 |
- collection: |
| 34 |
id: &collection1 collection1 |
| 35 |
database: *database1 |
| 36 |
collectionName: *collection1 |
| 37 |
- database: |
| 38 |
id: &globalDatabase0 globalDatabase0 |
| 39 |
client: *globalClient |
| 40 |
databaseName: *database0 |
| 41 |
- collection: |
| 42 |
id: &globalCollection0 globalCollection0 |
| 43 |
database: *globalDatabase0 |
| 44 |
collectionName: *collection0 |
| 45 |
- database: |
| 46 |
id: &globalDatabase1 globalDatabase1 |
| 47 |
client: *globalClient |
| 48 |
databaseName: *database1 |
| 49 |
- collection: |
| 50 |
id: &globalCollection1 globalCollection1 |
| 51 |
database: *globalDatabase1 |
| 52 |
collectionName: *collection1 |
| 53 |
|
| 54 |
- collection: |
| 55 |
id: &globalDb1Collection0 globalDb1Collection0 |
| 56 |
database: *globalDatabase1 |
| 57 |
collectionName: *collection0 |
| 58 |
- collection: |
| 59 |
id: &globalDb0Collection1 globalDb0Collection1 |
| 60 |
database: *globalDatabase0 |
| 61 |
collectionName: *collection1 |
| 62 |
|
| 63 |
initialData: |
| 64 |
- collectionName: *collection0 |
| 65 |
databaseName: *database0 |
| 66 |
documents: [] |
| 67 |
|
| 68 |
tests: |
| 69 |
- description: "Test array truncation" |
| 70 |
runOnRequirements: |
| 71 |
- minServerVersion: "4.7" |
| 72 |
operations: |
| 73 |
- name: insertOne |
| 74 |
object: *collection0 |
| 75 |
arguments: |
| 76 |
document: { |
| 77 |
"_id": 1, |
| 78 |
"a": 1, |
| 79 |
"array": ["foo", {"a": "bar"}, 1, 2, 3] |
| 80 |
} |
| 81 |
- name: createChangeStream |
| 82 |
object: *collection0 |
| 83 |
arguments: { pipeline: [] } |
| 84 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 85 |
- name: updateOne |
| 86 |
object: *collection0 |
| 87 |
arguments: |
| 88 |
filter: { |
| 89 |
"_id": 1 |
| 90 |
} |
| 91 |
update: [ |
| 92 |
{ |
| 93 |
"$set": { |
| 94 |
"array": ["foo", {"a": "bar"}] |
| 95 |
} |
| 96 |
} |
| 97 |
] |
| 98 |
- name: iterateUntilDocumentOrError |
| 99 |
object: *changeStream0 |
| 100 |
expectResult: { |
| 101 |
"operationType": "update", |
| 102 |
"ns": { |
| 103 |
"db": "database0", |
| 104 |
"coll": "collection0" |
| 105 |
}, |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
"updateDescription": { |
| 111 |
"updatedFields": {}, |
| 112 |
"removedFields": [], |
| 113 |
"truncatedArrays": [ |
| 114 |
{ |
| 115 |
"field": "array", |
| 116 |
"newSize": 2 |
| 117 |
} |
| 118 |
], |
| 119 |
disambiguatedPaths: { $$unsetOrMatches: { $$exists: true } } |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
- description: "Test with document comment" |
| 124 |
runOnRequirements: |
| 125 |
- minServerVersion: "4.4" |
| 126 |
operations: |
| 127 |
- name: createChangeStream |
| 128 |
object: *collection0 |
| 129 |
arguments: |
| 130 |
pipeline: [] |
| 131 |
comment: &comment0 { name: "test1" } |
| 132 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 133 |
expectEvents: |
| 134 |
- client: *client0 |
| 135 |
events: |
| 136 |
- commandStartedEvent: |
| 137 |
command: |
| 138 |
aggregate: *collection0 |
| 139 |
pipeline: |
| 140 |
- $changeStream: {} |
| 141 |
comment: *comment0 |
| 142 |
|
| 143 |
- description: "Test with document comment - pre 4.4" |
| 144 |
runOnRequirements: |
| 145 |
- maxServerVersion: "4.2.99" |
| 146 |
operations: |
| 147 |
- name: createChangeStream |
| 148 |
object: *collection0 |
| 149 |
arguments: |
| 150 |
pipeline: [] |
| 151 |
comment: &comment0 { name: "test1" } |
| 152 |
expectError: |
| 153 |
isClientError: false |
| 154 |
expectEvents: |
| 155 |
- client: *client0 |
| 156 |
events: |
| 157 |
- commandStartedEvent: |
| 158 |
command: |
| 159 |
aggregate: *collection0 |
| 160 |
pipeline: |
| 161 |
- $changeStream: {} |
| 162 |
comment: *comment0 |
| 163 |
|
| 164 |
- description: "Test with string comment" |
| 165 |
operations: |
| 166 |
- name: createChangeStream |
| 167 |
object: *collection0 |
| 168 |
arguments: |
| 169 |
pipeline: [] |
| 170 |
comment: "comment" |
| 171 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 172 |
expectEvents: |
| 173 |
- client: *client0 |
| 174 |
events: |
| 175 |
- commandStartedEvent: |
| 176 |
command: |
| 177 |
aggregate: *collection0 |
| 178 |
pipeline: |
| 179 |
- $changeStream: {} |
| 180 |
comment: "comment" |
| 181 |
|
| 182 |
- description: "Test that comment is set on getMore" |
| 183 |
runOnRequirements: |
| 184 |
- minServerVersion: "4.4.0" |
| 185 |
operations: |
| 186 |
- name: createChangeStream |
| 187 |
object: *collection0 |
| 188 |
arguments: |
| 189 |
pipeline: [] |
| 190 |
comment: &commentDoc |
| 191 |
key: "value" |
| 192 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 193 |
- name: insertOne |
| 194 |
object: *collection0 |
| 195 |
arguments: |
| 196 |
document: &new_document |
| 197 |
_id: 1 |
| 198 |
a: 1 |
| 199 |
- name: iterateUntilDocumentOrError |
| 200 |
object: *changeStream0 |
| 201 |
expectEvents: |
| 202 |
- client: *client0 |
| 203 |
events: |
| 204 |
- commandStartedEvent: |
| 205 |
command: |
| 206 |
aggregate: *collection0 |
| 207 |
pipeline: |
| 208 |
- $changeStream: {} |
| 209 |
comment: *commentDoc |
| 210 |
- commandStartedEvent: |
| 211 |
command: |
| 212 |
insert: *collection0 |
| 213 |
documents: |
| 214 |
- *new_document |
| 215 |
- commandStartedEvent: |
| 216 |
command: |
| 217 |
getMore: { $$type: [ int, long ] } |
| 218 |
collection: *collection0 |
| 219 |
comment: *commentDoc |
| 220 |
commandName: getMore |
| 221 |
databaseName: *database0 |
| 222 |
|
| 223 |
- description: "Test that comment is not set on getMore - pre 4.4" |
| 224 |
runOnRequirements: |
| 225 |
- maxServerVersion: "4.3.99" |
| 226 |
operations: |
| 227 |
- name: createChangeStream |
| 228 |
object: *collection0 |
| 229 |
arguments: |
| 230 |
pipeline: [] |
| 231 |
comment: "comment" |
| 232 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 233 |
- name: insertOne |
| 234 |
object: *collection0 |
| 235 |
arguments: |
| 236 |
document: &new_document |
| 237 |
_id: 1 |
| 238 |
a: 1 |
| 239 |
- name: iterateUntilDocumentOrError |
| 240 |
object: *changeStream0 |
| 241 |
expectEvents: |
| 242 |
- client: *client0 |
| 243 |
events: |
| 244 |
- commandStartedEvent: |
| 245 |
command: |
| 246 |
aggregate: *collection0 |
| 247 |
pipeline: |
| 248 |
- $changeStream: {} |
| 249 |
comment: "comment" |
| 250 |
- commandStartedEvent: |
| 251 |
command: |
| 252 |
insert: *collection0 |
| 253 |
documents: |
| 254 |
- *new_document |
| 255 |
- commandStartedEvent: |
| 256 |
command: |
| 257 |
getMore: { $$type: [ int, long ] } |
| 258 |
collection: *collection0 |
| 259 |
comment: { $$exists: false } |
| 260 |
commandName: getMore |
| 261 |
databaseName: *database0 |
| 262 |
|
| 263 |
- description: "to field is set in a rename change event" |
| 264 |
runOnRequirements: |
| 265 |
- minServerVersion: "4.0.1" |
| 266 |
operations: |
| 267 |
- name: createChangeStream |
| 268 |
object: *collection0 |
| 269 |
arguments: { pipeline: [] } |
| 270 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 271 |
- name: dropCollection |
| 272 |
object: *database0 |
| 273 |
arguments: |
| 274 |
collection: &collection1 collection1 |
| 275 |
- name: rename |
| 276 |
object: *collection0 |
| 277 |
arguments: |
| 278 |
to: *collection1 |
| 279 |
- name: iterateUntilDocumentOrError |
| 280 |
object: *changeStream0 |
| 281 |
expectResult: |
| 282 |
operationType: rename |
| 283 |
ns: |
| 284 |
db: *database0 |
| 285 |
coll: *collection0 |
| 286 |
to: |
| 287 |
db: *database0 |
| 288 |
coll: *collection1 |
| 289 |
|
| 290 |
- description: "Test unknown operationType MUST NOT err" |
| 291 |
operations: |
| 292 |
- name: createChangeStream |
| 293 |
object: *collection0 |
| 294 |
arguments: |
| 295 |
|
| 296 |
pipeline: [ { $project: { operationType: "addedInFutureMongoDBVersion", ns: 1 } } ] |
| 297 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 298 |
- name: insertOne |
| 299 |
object: *collection0 |
| 300 |
arguments: |
| 301 |
document: { "_id": 1, "a": 1 } |
| 302 |
- name: iterateUntilDocumentOrError |
| 303 |
object: *changeStream0 |
| 304 |
expectResult: |
| 305 |
operationType: "addedInFutureMongoDBVersion" |
| 306 |
ns: |
| 307 |
db: *database0 |
| 308 |
coll: *collection0 |
| 309 |
|
| 310 |
- description: "Test newField added in response MUST NOT err" |
| 311 |
operations: |
| 312 |
- name: createChangeStream |
| 313 |
object: *collection0 |
| 314 |
arguments: |
| 315 |
|
| 316 |
pipeline: [ { $project: { operationType: 1, ns: 1, newField: "newFieldValue" } } ] |
| 317 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 318 |
- name: insertOne |
| 319 |
object: *collection0 |
| 320 |
arguments: |
| 321 |
document: { "_id": 1, "a": 1 } |
| 322 |
- name: iterateUntilDocumentOrError |
| 323 |
object: *changeStream0 |
| 324 |
expectResult: |
| 325 |
operationType: "insert" |
| 326 |
ns: |
| 327 |
db: *database0 |
| 328 |
coll: *collection0 |
| 329 |
newField: "newFieldValue" |
| 330 |
|
| 331 |
- description: "Test new structure in ns document MUST NOT err" |
| 332 |
runOnRequirements: |
| 333 |
- minServerVersion: "3.6" |
| 334 |
maxServerVersion: "5.2.99" |
| 335 |
- minServerVersion: "6.0" |
| 336 |
operations: |
| 337 |
- name: createChangeStream |
| 338 |
object: *collection0 |
| 339 |
arguments: |
| 340 |
|
| 341 |
pipeline: [ { $project: { operationType: "insert", "ns.viewOn": "db.coll" } } ] |
| 342 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 343 |
- name: insertOne |
| 344 |
object: *collection0 |
| 345 |
arguments: |
| 346 |
document: { "_id": 1, "a": 1 } |
| 347 |
- name: iterateUntilDocumentOrError |
| 348 |
object: *changeStream0 |
| 349 |
expectResult: |
| 350 |
operationType: "insert" |
| 351 |
ns: |
| 352 |
viewOn: "db.coll" |
| 353 |
|
| 354 |
- description: "Test modified structure in ns document MUST NOT err" |
| 355 |
operations: |
| 356 |
- name: createChangeStream |
| 357 |
object: *collection0 |
| 358 |
arguments: |
| 359 |
|
| 360 |
pipeline: [ { $project: { operationType: "insert", ns: { db: "$ns.db", coll: "$ns.coll", viewOn: "db.coll" } } } ] |
| 361 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 362 |
- name: insertOne |
| 363 |
object: *collection0 |
| 364 |
arguments: |
| 365 |
document: { "_id": 1, "a": 1 } |
| 366 |
- name: iterateUntilDocumentOrError |
| 367 |
object: *changeStream0 |
| 368 |
expectResult: |
| 369 |
operationType: "insert" |
| 370 |
ns: |
| 371 |
db: *database0 |
| 372 |
coll: *collection0 |
| 373 |
viewOn: "db.coll" |
| 374 |
|
| 375 |
- description: "Test server error on projecting out _id" |
| 376 |
runOnRequirements: |
| 377 |
- minServerVersion: "4.2" |
| 378 |
|
| 379 |
operations: |
| 380 |
- name: createChangeStream |
| 381 |
object: *collection0 |
| 382 |
arguments: |
| 383 |
pipeline: [ { $project: { _id: 0 } } ] |
| 384 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 385 |
- name: insertOne |
| 386 |
object: *collection0 |
| 387 |
arguments: |
| 388 |
document: { "_id": 1, "a": 1 } |
| 389 |
- name: iterateUntilDocumentOrError |
| 390 |
object: *changeStream0 |
| 391 |
expectError: |
| 392 |
errorCode: 280 |
| 393 |
errorCodeName: "ChangeStreamFatalError" |
| 394 |
errorLabelsContain: [ "NonResumableChangeStreamError" ] |
| 395 |
|
| 396 |
- description: "Test projection in change stream returns expected fields" |
| 397 |
operations: |
| 398 |
- name: createChangeStream |
| 399 |
object: *collection0 |
| 400 |
arguments: |
| 401 |
pipeline: [ { $project: { optype: "$operationType", ns: 1, newField: "value" } } ] |
| 402 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 403 |
- name: insertOne |
| 404 |
object: *collection0 |
| 405 |
arguments: |
| 406 |
document: { "_id": 1, "a": 1 } |
| 407 |
- name: iterateUntilDocumentOrError |
| 408 |
object: *changeStream0 |
| 409 |
expectResult: |
| 410 |
optype: "insert" |
| 411 |
ns: |
| 412 |
db: *database0 |
| 413 |
coll: *collection0 |
| 414 |
newField: "value" |
| 415 |
|
| 416 |
- description: $changeStream must be the first stage in a change stream pipeline sent to the server |
| 417 |
runOnRequirements: |
| 418 |
- minServerVersion: "3.6.0" |
| 419 |
operations: |
| 420 |
- name: createChangeStream |
| 421 |
object: *collection0 |
| 422 |
arguments: { pipeline: [] } |
| 423 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 424 |
- name: insertOne |
| 425 |
object: *globalCollection0 |
| 426 |
arguments: |
| 427 |
document: { x: 1 } |
| 428 |
- name: iterateUntilDocumentOrError |
| 429 |
object: *changeStream0 |
| 430 |
expectResult: |
| 431 |
_id: { $$exists: true } |
| 432 |
documentKey: { $$exists: true } |
| 433 |
operationType: insert |
| 434 |
ns: |
| 435 |
db: *database0 |
| 436 |
coll: *collection0 |
| 437 |
fullDocument: |
| 438 |
x: 1 |
| 439 |
_id: { $$exists: true } |
| 440 |
expectEvents: |
| 441 |
- client: *client0 |
| 442 |
ignoreExtraEvents: true |
| 443 |
events: |
| 444 |
- commandStartedEvent: |
| 445 |
command: |
| 446 |
aggregate: *collection0 |
| 447 |
cursor: {} |
| 448 |
pipeline: [ { $changeStream: {} } ] |
| 449 |
commandName: aggregate |
| 450 |
databaseName: *database0 |
| 451 |
|
| 452 |
- description: The server returns change stream responses in the specified server response format |
| 453 |
runOnRequirements: |
| 454 |
- minServerVersion: "3.6.0" |
| 455 |
operations: |
| 456 |
- name: createChangeStream |
| 457 |
object: *collection0 |
| 458 |
arguments: { pipeline: [] } |
| 459 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 460 |
- name: insertOne |
| 461 |
object: *globalCollection0 |
| 462 |
arguments: |
| 463 |
document: { x: 1 } |
| 464 |
- name: iterateUntilDocumentOrError |
| 465 |
object: *changeStream0 |
| 466 |
expectResult: |
| 467 |
_id: { $$exists: true } |
| 468 |
documentKey: { $$exists: true } |
| 469 |
operationType: insert |
| 470 |
ns: |
| 471 |
db: *database0 |
| 472 |
coll: *collection0 |
| 473 |
fullDocument: |
| 474 |
x: 1 |
| 475 |
_id: { $$exists: true } |
| 476 |
|
| 477 |
- description: Executing a watch helper on a Collection results in notifications for changes to the specified collection |
| 478 |
runOnRequirements: |
| 479 |
- minServerVersion: "3.6.0" |
| 480 |
operations: |
| 481 |
- name: createChangeStream |
| 482 |
object: *collection0 |
| 483 |
arguments: { pipeline: [] } |
| 484 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 485 |
- name: insertOne |
| 486 |
object: *globalDb0Collection1 |
| 487 |
arguments: |
| 488 |
document: { x: 1 } |
| 489 |
- name: insertOne |
| 490 |
object: *globalDb1Collection0 |
| 491 |
arguments: |
| 492 |
document: { y: 2 } |
| 493 |
- name: insertOne |
| 494 |
object: *globalCollection0 |
| 495 |
arguments: |
| 496 |
document: { z: 3 } |
| 497 |
- name: iterateUntilDocumentOrError |
| 498 |
object: *changeStream0 |
| 499 |
expectResult: |
| 500 |
operationType: insert |
| 501 |
ns: |
| 502 |
db: *database0 |
| 503 |
coll: *collection0 |
| 504 |
fullDocument: |
| 505 |
z: 3 |
| 506 |
_id: { $$exists: true } |
| 507 |
expectEvents: |
| 508 |
- client: *client0 |
| 509 |
ignoreExtraEvents: true |
| 510 |
events: |
| 511 |
- commandStartedEvent: |
| 512 |
command: |
| 513 |
aggregate: *collection0 |
| 514 |
cursor: {} |
| 515 |
pipeline: [ { $changeStream: {} } ] |
| 516 |
commandName: aggregate |
| 517 |
databaseName: *database0 |
| 518 |
|
| 519 |
- description: Change Stream should allow valid aggregate pipeline stages |
| 520 |
runOnRequirements: |
| 521 |
- minServerVersion: "3.6.0" |
| 522 |
operations: |
| 523 |
- name: createChangeStream |
| 524 |
object: *collection0 |
| 525 |
arguments: |
| 526 |
pipeline: |
| 527 |
- $match: |
| 528 |
fullDocument.z: 3 |
| 529 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 530 |
- name: insertOne |
| 531 |
object: *globalCollection0 |
| 532 |
arguments: |
| 533 |
document: { y: 2 } |
| 534 |
- name: insertOne |
| 535 |
object: *globalCollection0 |
| 536 |
arguments: |
| 537 |
document: { z: 3 } |
| 538 |
- name: iterateUntilDocumentOrError |
| 539 |
object: *changeStream0 |
| 540 |
expectResult: |
| 541 |
operationType: insert |
| 542 |
ns: |
| 543 |
db: *database0 |
| 544 |
coll: *collection0 |
| 545 |
fullDocument: |
| 546 |
z: 3 |
| 547 |
_id: { $$exists: true } |
| 548 |
expectEvents: |
| 549 |
- client: *client0 |
| 550 |
ignoreExtraEvents: true |
| 551 |
events: |
| 552 |
- commandStartedEvent: |
| 553 |
command: |
| 554 |
aggregate: *collection0 |
| 555 |
cursor: {} |
| 556 |
pipeline: |
| 557 |
- $changeStream: {} |
| 558 |
- $match: |
| 559 |
fullDocument.z: 3 |
| 560 |
commandName: aggregate |
| 561 |
databaseName: *database0 |
| 562 |
|
| 563 |
- description: Executing a watch helper on a Database results in notifications for changes to all collections in the specified database. |
| 564 |
runOnRequirements: |
| 565 |
- minServerVersion: "3.8.0" |
| 566 |
operations: |
| 567 |
- name: createChangeStream |
| 568 |
object: *database0 |
| 569 |
arguments: { pipeline: [] } |
| 570 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 571 |
- name: insertOne |
| 572 |
object: *globalDb0Collection1 |
| 573 |
arguments: |
| 574 |
document: { x: 1 } |
| 575 |
- name: insertOne |
| 576 |
object: *globalDb1Collection0 |
| 577 |
arguments: |
| 578 |
document: { y: 2 } |
| 579 |
- name: insertOne |
| 580 |
object: *globalCollection0 |
| 581 |
arguments: |
| 582 |
document: { z: 3 } |
| 583 |
- name: iterateUntilDocumentOrError |
| 584 |
object: *changeStream0 |
| 585 |
expectResult: |
| 586 |
operationType: insert |
| 587 |
ns: |
| 588 |
db: *database0 |
| 589 |
coll: *collection1 |
| 590 |
fullDocument: |
| 591 |
x: 1 |
| 592 |
_id: { $$exists: true } |
| 593 |
- name: iterateUntilDocumentOrError |
| 594 |
object: *changeStream0 |
| 595 |
expectResult: |
| 596 |
operationType: insert |
| 597 |
ns: |
| 598 |
db: *database0 |
| 599 |
coll: *collection0 |
| 600 |
fullDocument: |
| 601 |
z: 3 |
| 602 |
_id: { $$exists: true } |
| 603 |
expectEvents: |
| 604 |
- client: *client0 |
| 605 |
ignoreExtraEvents: true |
| 606 |
events: |
| 607 |
- commandStartedEvent: |
| 608 |
command: |
| 609 |
aggregate: 1 |
| 610 |
cursor: {} |
| 611 |
pipeline: [ { $changeStream: {} } ] |
| 612 |
commandName: aggregate |
| 613 |
databaseName: *database0 |
| 614 |
|
| 615 |
- description: Executing a watch helper on a MongoClient results in notifications for changes to all collections in all databases in the cluster. |
| 616 |
runOnRequirements: |
| 617 |
- minServerVersion: "3.8.0" |
| 618 |
operations: |
| 619 |
- name: createChangeStream |
| 620 |
object: *client0 |
| 621 |
arguments: { pipeline: [] } |
| 622 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 623 |
- name: insertOne |
| 624 |
object: *globalDb0Collection1 |
| 625 |
arguments: |
| 626 |
document: { x: 1 } |
| 627 |
- name: insertOne |
| 628 |
object: *globalDb1Collection0 |
| 629 |
arguments: |
| 630 |
document: { y: 2 } |
| 631 |
- name: insertOne |
| 632 |
object: *globalCollection0 |
| 633 |
arguments: |
| 634 |
document: { z: 3 } |
| 635 |
- name: iterateUntilDocumentOrError |
| 636 |
object: *changeStream0 |
| 637 |
expectResult: |
| 638 |
operationType: insert |
| 639 |
ns: |
| 640 |
db: *database0 |
| 641 |
coll: *collection1 |
| 642 |
fullDocument: |
| 643 |
x: 1 |
| 644 |
_id: { $$exists: true } |
| 645 |
- name: iterateUntilDocumentOrError |
| 646 |
object: *changeStream0 |
| 647 |
expectResult: |
| 648 |
operationType: insert |
| 649 |
ns: |
| 650 |
db: *database1 |
| 651 |
coll: *collection0 |
| 652 |
fullDocument: |
| 653 |
y: 2 |
| 654 |
_id: { $$exists: true } |
| 655 |
- name: iterateUntilDocumentOrError |
| 656 |
object: *changeStream0 |
| 657 |
expectResult: |
| 658 |
operationType: insert |
| 659 |
ns: |
| 660 |
db: *database0 |
| 661 |
coll: *collection0 |
| 662 |
fullDocument: |
| 663 |
z: 3 |
| 664 |
_id: { $$exists: true } |
| 665 |
expectEvents: |
| 666 |
- client: *client0 |
| 667 |
ignoreExtraEvents: true |
| 668 |
events: |
| 669 |
- commandStartedEvent: |
| 670 |
command: |
| 671 |
aggregate: 1 |
| 672 |
cursor: {} |
| 673 |
pipeline: |
| 674 |
- $changeStream: { allChangesForCluster: true } |
| 675 |
commandName: aggregate |
| 676 |
databaseName: admin |
| 677 |
|
| 678 |
- description: "Test insert, update, replace, and delete event types" |
| 679 |
runOnRequirements: |
| 680 |
- minServerVersion: "3.6.0" |
| 681 |
operations: |
| 682 |
- name: createChangeStream |
| 683 |
object: *collection0 |
| 684 |
arguments: { pipeline: [] } |
| 685 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 686 |
- name: insertOne |
| 687 |
object: *globalCollection0 |
| 688 |
arguments: |
| 689 |
document: { x: 1 } |
| 690 |
- name: updateOne |
| 691 |
object: *globalCollection0 |
| 692 |
arguments: |
| 693 |
filter: { x: 1 } |
| 694 |
update: |
| 695 |
$set: { x: 2 } |
| 696 |
- name: replaceOne |
| 697 |
object: *globalCollection0 |
| 698 |
arguments: |
| 699 |
filter: { x: 2 } |
| 700 |
replacement: { x: 3 } |
| 701 |
- name: deleteOne |
| 702 |
object: *globalCollection0 |
| 703 |
arguments: |
| 704 |
filter: { x: 3 } |
| 705 |
- name: iterateUntilDocumentOrError |
| 706 |
object: *changeStream0 |
| 707 |
expectResult: |
| 708 |
operationType: insert |
| 709 |
ns: |
| 710 |
db: *database0 |
| 711 |
coll: *collection0 |
| 712 |
fullDocument: |
| 713 |
x: 1 |
| 714 |
_id: { $$exists: true } |
| 715 |
- name: iterateUntilDocumentOrError |
| 716 |
object: *changeStream0 |
| 717 |
expectResult: |
| 718 |
operationType: update |
| 719 |
ns: |
| 720 |
db: *database0 |
| 721 |
coll: *collection0 |
| 722 |
updateDescription: |
| 723 |
updatedFields: { x: 2 } |
| 724 |
removedFields: [] |
| 725 |
truncatedArrays: { $$unsetOrMatches: { $$exists: true } } |
| 726 |
disambiguatedPaths: { $$unsetOrMatches: { $$exists: true } } |
| 727 |
- name: iterateUntilDocumentOrError |
| 728 |
object: *changeStream0 |
| 729 |
expectResult: |
| 730 |
operationType: replace |
| 731 |
ns: |
| 732 |
db: *database0 |
| 733 |
coll: *collection0 |
| 734 |
fullDocument: |
| 735 |
x: 3 |
| 736 |
_id: { $$exists: true } |
| 737 |
- name: iterateUntilDocumentOrError |
| 738 |
object: *changeStream0 |
| 739 |
expectResult: |
| 740 |
operationType: delete |
| 741 |
ns: |
| 742 |
db: *database0 |
| 743 |
coll: *collection0 |
| 744 |
expectEvents: |
| 745 |
- client: *client0 |
| 746 |
ignoreExtraEvents: true |
| 747 |
events: |
| 748 |
- commandStartedEvent: |
| 749 |
command: |
| 750 |
aggregate: *collection0 |
| 751 |
cursor: {} |
| 752 |
pipeline: [ { $changeStream: {} } ] |
| 753 |
commandName: aggregate |
| 754 |
databaseName: *database0 |
| 755 |
|
| 756 |
- description: Test rename and invalidate event types |
| 757 |
runOnRequirements: |
| 758 |
- minServerVersion: "4.0.1" |
| 759 |
operations: |
| 760 |
- name: createChangeStream |
| 761 |
object: *collection0 |
| 762 |
arguments: { pipeline: [] } |
| 763 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 764 |
- name: dropCollection |
| 765 |
object: *database0 |
| 766 |
arguments: |
| 767 |
collection: *collection1 |
| 768 |
- name: rename |
| 769 |
object: *globalCollection0 |
| 770 |
arguments: |
| 771 |
to: *collection1 |
| 772 |
- name: iterateUntilDocumentOrError |
| 773 |
object: *changeStream0 |
| 774 |
expectResult: |
| 775 |
operationType: rename |
| 776 |
ns: |
| 777 |
db: *database0 |
| 778 |
coll: *collection0 |
| 779 |
to: |
| 780 |
db: *database0 |
| 781 |
coll: *collection1 |
| 782 |
- name: iterateUntilDocumentOrError |
| 783 |
object: *changeStream0 |
| 784 |
expectResult: |
| 785 |
operationType: invalidate |
| 786 |
expectEvents: |
| 787 |
- client: *client0 |
| 788 |
ignoreExtraEvents: true |
| 789 |
events: |
| 790 |
- commandStartedEvent: |
| 791 |
command: |
| 792 |
aggregate: *collection0 |
| 793 |
cursor: {} |
| 794 |
pipeline: [ { $changeStream: {} } ] |
| 795 |
commandName: aggregate |
| 796 |
databaseName: *database0 |
| 797 |
|
| 798 |
- description: Test drop and invalidate event types |
| 799 |
runOnRequirements: |
| 800 |
- minServerVersion: "4.0.1" |
| 801 |
operations: |
| 802 |
- name: createChangeStream |
| 803 |
object: *collection0 |
| 804 |
arguments: { pipeline: [] } |
| 805 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 806 |
- name: dropCollection |
| 807 |
object: *database0 |
| 808 |
arguments: |
| 809 |
collection: *collection0 |
| 810 |
- name: iterateUntilDocumentOrError |
| 811 |
object: *changeStream0 |
| 812 |
expectResult: |
| 813 |
operationType: drop |
| 814 |
ns: |
| 815 |
db: *database0 |
| 816 |
coll: *collection0 |
| 817 |
- name: iterateUntilDocumentOrError |
| 818 |
object: *changeStream0 |
| 819 |
expectResult: |
| 820 |
operationType: invalidate |
| 821 |
expectEvents: |
| 822 |
- client: *client0 |
| 823 |
ignoreExtraEvents: true |
| 824 |
events: |
| 825 |
- commandStartedEvent: |
| 826 |
command: |
| 827 |
aggregate: *collection0 |
| 828 |
cursor: {} |
| 829 |
pipeline: [ { $changeStream: {} } ] |
| 830 |
commandName: aggregate |
| 831 |
databaseName: *database0 |
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
- description: Test consecutive resume |
| 836 |
runOnRequirements: |
| 837 |
- minServerVersion: "4.1.7" |
| 838 |
operations: |
| 839 |
- name: failPoint |
| 840 |
object: testRunner |
| 841 |
arguments: |
| 842 |
client: *globalClient |
| 843 |
failPoint: |
| 844 |
configureFailPoint: failCommand |
| 845 |
mode: { times: 2 } |
| 846 |
data: |
| 847 |
failCommands: [ getMore ] |
| 848 |
closeConnection: true |
| 849 |
- name: createChangeStream |
| 850 |
object: *collection0 |
| 851 |
arguments: |
| 852 |
pipeline: [] |
| 853 |
batchSize: 1 |
| 854 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 855 |
- name: insertOne |
| 856 |
object: *globalCollection0 |
| 857 |
arguments: |
| 858 |
document: { x: 1 } |
| 859 |
- name: insertOne |
| 860 |
object: *globalCollection0 |
| 861 |
arguments: |
| 862 |
document: { x: 2 } |
| 863 |
- name: insertOne |
| 864 |
object: *globalCollection0 |
| 865 |
arguments: |
| 866 |
document: { x: 3 } |
| 867 |
- name: iterateUntilDocumentOrError |
| 868 |
object: *changeStream0 |
| 869 |
expectResult: |
| 870 |
operationType: insert |
| 871 |
ns: |
| 872 |
db: *database0 |
| 873 |
coll: *collection0 |
| 874 |
fullDocument: |
| 875 |
x: 1 |
| 876 |
_id: { $$exists: true } |
| 877 |
- name: iterateUntilDocumentOrError |
| 878 |
object: *changeStream0 |
| 879 |
expectResult: |
| 880 |
operationType: insert |
| 881 |
ns: |
| 882 |
db: *database0 |
| 883 |
coll: *collection0 |
| 884 |
fullDocument: |
| 885 |
x: 2 |
| 886 |
_id: { $$exists: true } |
| 887 |
- name: iterateUntilDocumentOrError |
| 888 |
object: *changeStream0 |
| 889 |
expectResult: |
| 890 |
operationType: insert |
| 891 |
ns: |
| 892 |
db: *database0 |
| 893 |
coll: *collection0 |
| 894 |
fullDocument: |
| 895 |
x: 3 |
| 896 |
_id: { $$exists: true } |
| 897 |
expectEvents: |
| 898 |
- client: *client0 |
| 899 |
ignoreExtraEvents: true |
| 900 |
events: |
| 901 |
- commandStartedEvent: |
| 902 |
command: |
| 903 |
aggregate: *collection0 |
| 904 |
cursor: |
| 905 |
batchSize: 1 |
| 906 |
pipeline: [ { $changeStream: {} } ] |
| 907 |
commandName: aggregate |
| 908 |
databaseName: *database0 |
| 909 |
|
| 910 |
- description: "Test wallTime field is set in a change event" |
| 911 |
runOnRequirements: |
| 912 |
- minServerVersion: "6.0.0" |
| 913 |
operations: |
| 914 |
- name: createChangeStream |
| 915 |
object: *collection0 |
| 916 |
arguments: { pipeline: [] } |
| 917 |
saveResultAsEntity: &changeStream0 changeStream0 |
| 918 |
- name: insertOne |
| 919 |
object: *collection0 |
| 920 |
arguments: |
| 921 |
document: { "_id": 1, "a": 1 } |
| 922 |
- name: iterateUntilDocumentOrError |
| 923 |
object: *changeStream0 |
| 924 |
expectResult: |
| 925 |
operationType: "insert" |
| 926 |
ns: |
| 927 |
db: *database0 |
| 928 |
coll: *collection0 |
| 929 |
wallTime: { $$exists: true } |