-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
None
-
None
-
None
-
None
-
None
-
None
It would be useful for $bsonSize & related operators to work with over-large documents. Then change streams could do stuff like:
cs = db.watch(
[
{$set: {
fullDocument: { $cond: [
{$gt: [{$bsonSize: "$$ROOT"}, 16 << 20]},
"truncated",
"$fullDocument",
]},
}},
],
{fullDocument: "updateLookup"},
);
const longString = "x".repeat(10 << 20);
db.foo.insert({_id: 1});
db.foo.updateOne({_id: 1}, {$set: {long: longString}});
The change stream’s `update` change event will exceed 16 MiB because it contains the update description—including the full 10-MiB string—as well as the `fullDocument`, which also includes the string. The aggregation tries to truncate `fullDocument` for such oversized events. The attempt fails, though, because $bsonSize itself can’t report the size of oversized documents.
- split from
-
SERVER-135206 $convert to binData fails on a document of exactly BSONObjMaxUserSize because RCString rejects the boundary size
-
- Closed
-