-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
Originating from this GitHub Issue: https://github.com/mongodb/js-bson/issues/211
For now adding method from an ES6 class to a deserialized object can be done using Object.assign() or Object.setPrototypeOf() which both have poor performance. It's nice if we can create the object from class (or even the class itself), pass it to BSON deserialize, and data is added to this object (or object instantiated from class) instead of var object = isArray ? [] : {}; at the first level of deserializing.
The PDO of PHP provide such functionally:
> PDO::FETCH_CLASS: returns a new instance of the requested class, mapping the columns of the result set to named properties in the class, and calling the constructor afterwards, unless PDO::FETCH_PROPS_LATE is also given.
The API must become available in Core Driver as well.
- is duplicated by
-
NODE-3013 Deserializing to custom targets (classes)
-
- Closed
-