Skip to content

Commit e3fcd88

Browse files
committed
fix(shell-bson): ObjectId constructor compatibility with bson 7.x
This is a breaking change in the 7.x bson package that we should hide from mongosh users.
1 parent 2eccdd0 commit e3fcd88

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/shell-bson/src/shell-bson.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ export function constructShellBson<
180180
[[undefined, 'string', 'number', 'object']],
181181
'ObjectId'
182182
);
183+
if (typeof id === 'number') return bson.ObjectId.createFromTime(id);
183184
return new bson.ObjectId(id);
184185
},
185186
pickWithExactKeyMatch(bson.ObjectId, ['prototype', 'cacheHexString', 'generate', 'createFromTime', 'createFromHexString', 'createFromBase64', 'isValid'])),

0 commit comments

Comments
 (0)