Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-3012

Codable BSON Objects

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            alexander.golin@mongodb.com Alexander Golin (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: