-
Type: Improvement
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: js-bson
-
Empty show more show less
When working with other serialization formats, like protobuf, it would be nice to have direct access to ObjectID's internal buffer property.
As seen in this code line (https://github.com/mongodb/js-bson/blob/1576fd0bc454b869b6445ac58e27810a7a221cb3/src/objectid.ts#L49 ), property/symbol `id` is marked as `private`.
This implies in conversion from hex string after calling the method `toHexString`, unnecessarily:
let buffer = Buffer.from(objectId.toHexString(), 'hex')
So, my proposal is to remove the `private` modifier of `id`property, or to implement a method `toBuffer`.
I can develop it and make a PR if you think it is nice to have.