-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: Not Applicable
-
Component/s: EJSON
-
None
From the ticket:
When I try stringify result from mongdb query I get error.const mongodb =
require('mongodb'); const bson = require('bson'); const mongoObjectId = new mongodb.ObjectId(); const bsonObjectId = new bson.ObjectId(); console.log(bson.EJSON.stringify(bsonObjectId)); // {"$oid":"5c092e78f381e590b57377c3"} try { console.log(bson.EJSON.stringify(mongoObjectId)); } catch (e) { console.error(e) //Error: invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [{"type":"Buffer","data":[]}] }