Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/mongo_logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,12 @@ export function stringifyWithMaxLen(
currentLength += value ? 4 : 5;
break;
case 'object':
if ('_bsontype' in value) {
if (isUint8Array(value)) {
// '{"$binary":{"base64":"<base64 string>","subType":"XX"}}'
// This is an estimate based on the fact that the base64 is approximately 1.33x the length of
// the actual binary sequence https://en.wikipedia.org/wiki/Base64
currentLength += (22 + value.byteLength + value.byteLength * 0.33 + 18) | 0;
} else if ('_bsontype' in value) {
const v = value as BSONObject;
switch (v._bsontype) {
case 'Int32':
Expand Down
Loading