This repository was archived by the owner on Jul 9, 2024. It is now read-only.

Description
Description
Instance of parsed ObjectId, using ejson-shell-parser (version >= 1.2.1), is different from bson.ObjectId instance (bson version >= 5.0.0-alpha.0).
Correctly work:
- CommonJS (type: commonjs) with
bson v4 and v5
- ESM (type: module) with
bson v4
Same problem with Timestamp, BSONSymbol, DBRef, MinKey, MaxKey.
Steps to reproduce:
yarn init -y
yarn set version canary
yarn add bson ejson-shell-parser
- Add
"type": "module" in pakcage.json
- Create
index.js file
import { ObjectId } from 'bson'
import parser from 'ejson-shell-parser'
const out = parser.default('ObjectId()')
console.log(out instanceof ObjectId)
Versions:
bson >= 5.0.0-alpha.0
ejson-shell-parser >= 1.2.1
Node: 16.17.0
Actual
log is false
Expect
log is true