You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.
constExtJSONModule=require("mongodb-extjson");constEJSON=newExtJSONModule();constBSON=ExtJSONModule.BSON;const{ ObjectID }=BSON;consttest1={_id: {"$nin": [{"$oid":"591801a468f9e7024b6235ea"}]}}conststr1=EJSON.stringify(test1);// this one worksconsole.log(str1);consttest2={_id: {"$nin": [newObjectID("591801a468f9e7024b6235ea")]}};conststr2=EJSON.stringify(test2);// throw exceptionconsole.log(str2);
It throws the following exception:
/Users/aviv/Documents/tryouts/extjson/node_modules/mongodb-extjson/lib/bson/objectid.js:89
throw new Error('invalid ObjectId, ObjectId.id must be either a string or a Uint8Array, but is [' + JSON.stringify(this.id) + ']');
^
Error: invalid ObjectId, ObjectId.id must be either a string or a Uint8Array, but is [{"0":{"$numberInt":"89"},"1":{"$numberInt":"24"},"2":{"$numberInt":"1"},"3":{"$numberInt":"164"},"4":{"$numberInt":"104"},"5":{"$numberInt":"249"},"6":{"$numberInt":"231"},"7":{"$numberInt":"2"},"8":{"$numberInt":"75"},"9":{"$numberInt":"98"},"10":{"$numberInt":"53"},"11":{"$numberInt":"234"}}]
at ObjectID.toHexString (/Users/aviv/Documents/tryouts/extjson/node_modules/mongodb-extjson/lib/bson/objectid.js:89:11)
at ObjectID.toJSON (/Users/aviv/Documents/tryouts/extjson/node_modules/mongodb-extjson/lib/bson/objectid.js:171:23)
at JSON.stringify (<anonymous>)
at ExtJSON.stringify (/Users/aviv/Documents/tryouts/extjson/node_modules/mongodb-extjson/lib/ext_json.js:161:15)
at Object.<anonymous> (/Users/aviv/Documents/tryouts/extjson/index.js:11:20)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
The text was updated successfully, but these errors were encountered:
It throws the following exception:
The text was updated successfully, but these errors were encountered: