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

Add a Long.fromStringStrict method

    • 3
    • 0
    • Not Needed
    • Hide

      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.

      Show
      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Use Case

      As a BSON and driver user
      I want to ensure strings that represent longs only contain valid digits and no overflows
      So that int64s are constructed from proper digit sequences.

      User Impact

      • New opt-in feature API

      Dependencies

      • None

      Unknowns

      None.

      Acceptance Criteria

      Implementation Requirements

      • Add a new static method to the Long class fromStringStrict that throws when the input contains invalid characters, whitespace or overflows
        • Long.fromStringStrict(str: string, unsigned?: boolean, radix?: number): Long
        • The method must support radixes from 2 through 36 inclusive
        • radix is an optional parameter that must default to 10
        • The method will return the Long representation if it is valid and throw an error if it is not.

      Testing Requirements

      • Test valid and invalid inputs

      Documentation Requirements

      • Put API docs on {{Long.fromStringStrict }}with example usage

      Follow Up Requirements

      • In v7 (next BSON major) NODE-5638 Long.fromString Strict will be called inside Long.fromString

            Assignee:
            aditi.khare@mongodb.com Aditi Khare
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: