|
23 | 23 | "database": "database0",
|
24 | 24 | "collectionName": "coll0"
|
25 | 25 | }
|
| 26 | + }, |
| 27 | + { |
| 28 | + "collection": { |
| 29 | + "id": "collection1", |
| 30 | + "database": "database0", |
| 31 | + "collectionName": "coll1" |
| 32 | + } |
26 | 33 | }
|
27 | 34 | ],
|
28 | 35 | "initialData": [
|
|
34 | 41 | "_id": 1
|
35 | 42 | }
|
36 | 43 | ]
|
| 44 | + }, |
| 45 | + { |
| 46 | + "collectionName": "coll1", |
| 47 | + "databaseName": "crud-tests", |
| 48 | + "documents": [] |
37 | 49 | }
|
38 | 50 | ],
|
39 | 51 | "tests": [
|
|
44 | 56 | "minServerVersion": "5.0"
|
45 | 57 | }
|
46 | 58 | ],
|
| 59 | + "operations": [ |
| 60 | + { |
| 61 | + "name": "aggregate", |
| 62 | + "object": "collection0", |
| 63 | + "arguments": { |
| 64 | + "pipeline": [ |
| 65 | + { |
| 66 | + "$match": { |
| 67 | + "$expr": { |
| 68 | + "$eq": [ |
| 69 | + "$_id", |
| 70 | + "$$id" |
| 71 | + ] |
| 72 | + } |
| 73 | + } |
| 74 | + }, |
| 75 | + { |
| 76 | + "$project": { |
| 77 | + "_id": 0, |
| 78 | + "x": "$$x", |
| 79 | + "y": "$$y", |
| 80 | + "rand": "$$rand" |
| 81 | + } |
| 82 | + } |
| 83 | + ], |
| 84 | + "let": { |
| 85 | + "id": 1, |
| 86 | + "x": "foo", |
| 87 | + "y": { |
| 88 | + "$literal": "bar" |
| 89 | + }, |
| 90 | + "rand": { |
| 91 | + "$rand": {} |
| 92 | + } |
| 93 | + } |
| 94 | + }, |
| 95 | + "expectResult": [ |
| 96 | + { |
| 97 | + "x": "foo", |
| 98 | + "y": "bar", |
| 99 | + "rand": { |
| 100 | + "$$type": "double" |
| 101 | + } |
| 102 | + } |
| 103 | + ] |
| 104 | + } |
| 105 | + ], |
| 106 | + "expectEvents": [ |
| 107 | + { |
| 108 | + "client": "client0", |
| 109 | + "events": [ |
| 110 | + { |
| 111 | + "commandStartedEvent": { |
| 112 | + "command": { |
| 113 | + "aggregate": "coll0", |
| 114 | + "pipeline": [ |
| 115 | + { |
| 116 | + "$match": { |
| 117 | + "$expr": { |
| 118 | + "$eq": [ |
| 119 | + "$_id", |
| 120 | + "$$id" |
| 121 | + ] |
| 122 | + } |
| 123 | + } |
| 124 | + }, |
| 125 | + { |
| 126 | + "$project": { |
| 127 | + "_id": 0, |
| 128 | + "x": "$$x", |
| 129 | + "y": "$$y", |
| 130 | + "rand": "$$rand" |
| 131 | + } |
| 132 | + } |
| 133 | + ], |
| 134 | + "let": { |
| 135 | + "id": 1, |
| 136 | + "x": "foo", |
| 137 | + "y": { |
| 138 | + "$literal": "bar" |
| 139 | + }, |
| 140 | + "rand": { |
| 141 | + "$rand": {} |
| 142 | + } |
| 143 | + } |
| 144 | + } |
| 145 | + } |
| 146 | + } |
| 147 | + ] |
| 148 | + } |
| 149 | + ] |
| 150 | + }, |
| 151 | + { |
| 152 | + "description": "Aggregate with let option and dollar-prefixed $literal value", |
| 153 | + "runOnRequirements": [ |
| 154 | + { |
| 155 | + "minServerVersion": "5.0", |
| 156 | + "topologies": [ |
| 157 | + "single", |
| 158 | + "replicaset" |
| 159 | + ] |
| 160 | + } |
| 161 | + ], |
47 | 162 | "operations": [
|
48 | 163 | {
|
49 | 164 | "name": "aggregate",
|
|
190 | 305 | ]
|
191 | 306 | }
|
192 | 307 | ]
|
| 308 | + }, |
| 309 | + { |
| 310 | + "description": "Aggregate to collection with let option", |
| 311 | + "runOnRequirements": [ |
| 312 | + { |
| 313 | + "minServerVersion": "5.0" |
| 314 | + } |
| 315 | + ], |
| 316 | + "operations": [ |
| 317 | + { |
| 318 | + "name": "aggregate", |
| 319 | + "object": "collection0", |
| 320 | + "arguments": { |
| 321 | + "pipeline": [ |
| 322 | + { |
| 323 | + "$match": { |
| 324 | + "$expr": { |
| 325 | + "$eq": [ |
| 326 | + "$_id", |
| 327 | + "$$id" |
| 328 | + ] |
| 329 | + } |
| 330 | + } |
| 331 | + }, |
| 332 | + { |
| 333 | + "$project": { |
| 334 | + "_id": 1 |
| 335 | + } |
| 336 | + }, |
| 337 | + { |
| 338 | + "$out": "coll1" |
| 339 | + } |
| 340 | + ], |
| 341 | + "let": { |
| 342 | + "id": 1 |
| 343 | + } |
| 344 | + } |
| 345 | + } |
| 346 | + ], |
| 347 | + "expectEvents": [ |
| 348 | + { |
| 349 | + "client": "client0", |
| 350 | + "events": [ |
| 351 | + { |
| 352 | + "commandStartedEvent": { |
| 353 | + "command": { |
| 354 | + "aggregate": "coll0", |
| 355 | + "pipeline": [ |
| 356 | + { |
| 357 | + "$match": { |
| 358 | + "$expr": { |
| 359 | + "$eq": [ |
| 360 | + "$_id", |
| 361 | + "$$id" |
| 362 | + ] |
| 363 | + } |
| 364 | + } |
| 365 | + }, |
| 366 | + { |
| 367 | + "$project": { |
| 368 | + "_id": 1 |
| 369 | + } |
| 370 | + }, |
| 371 | + { |
| 372 | + "$out": "coll1" |
| 373 | + } |
| 374 | + ], |
| 375 | + "let": { |
| 376 | + "id": 1 |
| 377 | + } |
| 378 | + } |
| 379 | + } |
| 380 | + } |
| 381 | + ] |
| 382 | + } |
| 383 | + ], |
| 384 | + "outcome": [ |
| 385 | + { |
| 386 | + "collectionName": "coll1", |
| 387 | + "databaseName": "crud-tests", |
| 388 | + "documents": [ |
| 389 | + { |
| 390 | + "_id": 1 |
| 391 | + } |
| 392 | + ] |
| 393 | + } |
| 394 | + ] |
| 395 | + }, |
| 396 | + { |
| 397 | + "description": "Aggregate to collection with let option unsupported (server-side error)", |
| 398 | + "runOnRequirements": [ |
| 399 | + { |
| 400 | + "minServerVersion": "2.6.0", |
| 401 | + "maxServerVersion": "4.4.99" |
| 402 | + } |
| 403 | + ], |
| 404 | + "operations": [ |
| 405 | + { |
| 406 | + "name": "aggregate", |
| 407 | + "object": "collection0", |
| 408 | + "arguments": { |
| 409 | + "pipeline": [ |
| 410 | + { |
| 411 | + "$match": { |
| 412 | + "$expr": { |
| 413 | + "$eq": [ |
| 414 | + "$_id", |
| 415 | + "$$id" |
| 416 | + ] |
| 417 | + } |
| 418 | + } |
| 419 | + }, |
| 420 | + { |
| 421 | + "$project": { |
| 422 | + "_id": 1 |
| 423 | + } |
| 424 | + }, |
| 425 | + { |
| 426 | + "$out": "coll1" |
| 427 | + } |
| 428 | + ], |
| 429 | + "let": { |
| 430 | + "id": 1 |
| 431 | + } |
| 432 | + }, |
| 433 | + "expectError": { |
| 434 | + "errorContains": "unrecognized field 'let'", |
| 435 | + "isClientError": false |
| 436 | + } |
| 437 | + } |
| 438 | + ], |
| 439 | + "expectEvents": [ |
| 440 | + { |
| 441 | + "client": "client0", |
| 442 | + "events": [ |
| 443 | + { |
| 444 | + "commandStartedEvent": { |
| 445 | + "command": { |
| 446 | + "aggregate": "coll0", |
| 447 | + "pipeline": [ |
| 448 | + { |
| 449 | + "$match": { |
| 450 | + "$expr": { |
| 451 | + "$eq": [ |
| 452 | + "$_id", |
| 453 | + "$$id" |
| 454 | + ] |
| 455 | + } |
| 456 | + } |
| 457 | + }, |
| 458 | + { |
| 459 | + "$project": { |
| 460 | + "_id": 1 |
| 461 | + } |
| 462 | + }, |
| 463 | + { |
| 464 | + "$out": "coll1" |
| 465 | + } |
| 466 | + ], |
| 467 | + "let": { |
| 468 | + "id": 1 |
| 469 | + } |
| 470 | + } |
| 471 | + } |
| 472 | + } |
| 473 | + ] |
| 474 | + } |
| 475 | + ] |
193 | 476 | }
|
194 | 477 | ]
|
195 | 478 | }
|
0 commit comments