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

BSON static builder methods should use current constructor

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

      Use Case

      As a BSON user
      I want static builders (Binary.createFromBase64, Timestamp.fromBits, etc.) to use the current constructor, "this"
      So that my subclasses are built by these methods.

      User Experience

      • What is the desired/expected outcome for the user once this ticket is implemented?
        • (class SuperLong extends Long {}).fromString("2") returns SuperLong

      Dependencies

      • None

      Risks/Unknowns

      • What could go wrong while implementing this change? (e.g., performance, inadvertent behavioral changes in adjacent functionality, existing tech debt, etc)
        • N/A. Feature.
      • Is there an opportunity for better cross-driver alignment or testing in this area?
        • No
      • Is there an opportunity to improve existing documentation on this subject?
        • API docs can mention this

      Acceptance Criteria

      Implementation Requirements

      • Audit all static builder functions for hardcoded use of their constructor and change them to use "this" instead.
        • In a static method "this" is the current class

      Testing Requirements

      • Regression testing

      Documentation Requirements

      • API docs

      Follow Up Requirements

      • Could this be a lint rule?

            Assignee:
            Unassigned Unassigned
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: