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

Design: Allow Number Options To Also Accept Int32 and Long

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: CRUD
    • Labels:

      Command options in the driver, such as batchSize or maxTimeMS currently only accept JS number as their values but Int32 and Long are also valid types for these options. Although this use case would be rare from a general usage standpoint, it has recently shown up in spec tests where loading tests not in EJSON relaxed mode converts these options to their respective non-promoted values and then do not get applied properly since they are not JS number types. Example: https://github.com/mongodb/node-mongodb-native/blob/main/src/cursor/abstract_cursor.ts#L186

      We should audit all cases in the driver where this is happening and fix them all.

      Note: the design should account for BigInt, pending NODE-3126, but a separate implementation ticket can be filed to actually introduce support for the case.

      • Dev note for follow up work: BSON needs to be able to serialize BigInt before it can be supported as options. Once it can be serialized we'll need to audit the many cases of filtering options by typeof number that would prevent BigInt from reaching the BSON layer.

            Assignee:
            Unassigned Unassigned
            Reporter:
            durran.jordan@mongodb.com Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: