diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-14 14:26:38 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-14 14:26:38 -0300 |
| commit | 294bc6ecabf14c09c9bc8644704921dcf97cb44e (patch) | |
| tree | 279b1e0bab53901a1647ac63c1c724f0f789a663 /jstests/aggregation/large_bson_mid_pipeline.js | |
| parent | 70be7c27a251621187a1de533462ae2bb1e3bd39 (diff) | |
| parent | 1e917fd798aa25b7066d4b414b51184f13d5a092 (diff) | |
Update upstream source from tag 'upstream/6.0.10'debian/6.0.10-1
Update to upstream version '6.0.10'
with Debian dir 2d176fa254eee97b139f712fec5709641335a8c3
Diffstat (limited to 'jstests/aggregation/large_bson_mid_pipeline.js')
| -rw-r--r-- | jstests/aggregation/large_bson_mid_pipeline.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/jstests/aggregation/large_bson_mid_pipeline.js b/jstests/aggregation/large_bson_mid_pipeline.js new file mode 100644 index 00000000000..0604bff86c2 --- /dev/null +++ b/jstests/aggregation/large_bson_mid_pipeline.js @@ -0,0 +1,27 @@ +/** + * Tests that extra-large BSON objects (>16MB) can be materialized for the '$match' stage in the + * middle of the query plan without throwing 'BSONObjectTooLarge' exception. + */ +(function() { +"use strict"; + +load("jstests/libs/analyze_plan.js"); // For 'getAggPlanStage()'. + +const testDB = db.getSiblingDB("jsTestName"); +assert.commandWorked(testDB.dropDatabase()); + +const coll = testDB.coll; +const largeString = 'x'.repeat(10 * 1024 * 1024); +assert.commandWorked(coll.insert({a: 1, b: largeString})); + +// Use '$addFields' to create extra-large documents in the middle of the pipeline followed by +// '$match'. Use '$_internalInhibitOptimization' to ensure '$match' is not removed by the optimizer. +const pipeline = [ + {$_internalInhibitOptimization: {}}, + {$addFields: {c: {$concat: ["$b", "-"]}}}, + {$match: {c: {$exists: true}}}, + {$project: {a: 1}} +]; + +assert.doesNotThrow(() => coll.aggregate(pipeline).toArray()); +})(); |
