diff --git a/packages/shell-bson/src/shell-bson.ts b/packages/shell-bson/src/shell-bson.ts index fcdedc39f..354a91d6c 100644 --- a/packages/shell-bson/src/shell-bson.ts +++ b/packages/shell-bson/src/shell-bson.ts @@ -180,6 +180,7 @@ export function constructShellBson< [[undefined, 'string', 'number', 'object']], 'ObjectId' ); + if (typeof id === 'number') return bson.ObjectId.createFromTime(id); return new bson.ObjectId(id); }, pickWithExactKeyMatch(bson.ObjectId, ['prototype', 'cacheHexString', 'generate', 'createFromTime', 'createFromHexString', 'createFromBase64', 'isValid'])),