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

[v4.x BACKPORT] makeClientMetadata duplicates the platform string upon options parsing

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.16.0
    • Affects Version/s: None
    • Component/s: None
    • 2
    • Not Needed
    • 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?

      Backport NODE-3998 to v4.x.

      Parent Ticket Description:

      What problem are you facing?

      The platform field of the client metadata is being set to:
      "Node.js v16.13.0, LE (unified)|Node.js v16.13.0, LE (unified)"
      the text after the vertical bar is supposed to be text from a driver wrapper or other custom driverInfo settings.

      What driver and relevant dependency versions are you using?

      Steps to reproduce?

      connect a 4.x client to mongod and inspect the connection logs.

      Acceptance Criteria

      • Prevent many calls to makeClientMetadata from duplicating the platform string
      • Refactor initial handshake generation.
      • Add unit testing to cover makeClientMetadata
      • Test that driverInfo options are appended only once
        • Users can provide driverInfo name, version, and platform, which should be appended to the Node.js results of those properties separated by a bar character '|'
        • Example: If I pass this driverInfo option into the MongoClient
          { driverInfo: { platform: 'myPlatform', name: 'myName', version: 'myVersion' } } 
          

          the metadata should have:

          {
            driver: { name: 'nodejs|myName', version: '4.7.0|myVersion' }
            platform: 'Node.js v16.13.0, LE (unified)|myPlatform' 
          }
          

          Each property (name, version, platform) is optional in driverInfo, we only append '|' + user data if passed a non-empty string.

      • Assert the results always have the following shape: (See linked reference slides)
        {
          driver: { 
            name: 'nodejs', 
            version: '4.7.0' 
          },
          os: {
            type: 'Darwin',
            name: 'darwin',
            architecture: 'x64',
            version: '21.5.0'
          },
          platform: 'Node.js v16.13.0, LE (unified)'
        }
        

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            dbeng-pm-bot PM Bot
            Warren James
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: