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

Add abstract commandName variable to AbstractOperation and subclasses

    • 5
    • 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?

      Use Case

      As a... Node Engineer
      I want...  to be able to access the name of a command at any point after the operation instance is constructed
      So that... server selection logging (NODE-4687) can be unblocked.

      User Impact

      • This will be an internal variable, no users will be directly affected.

      Dependencies

      • No breaking changes

      Acceptance Criteria

      Implementation Requirements

      • Add abstract get commandName() to AbstractOperation and all direct subclasses of AbstractOperation
        • ex: FindOperation, InsertOperation, CreateIndexesOperation... 
        • commandName will match the command key originally only available during/after command execution
        • commandName trickles down subclasses unless overridden
        • commandName accessible through operation.commandName and subclassName.prototype's getter call (do not use "this" keyword in getter)

      Testing Requirements

      • Testing: add unit tests for all subclasses of abstractOperation:
        • Ensure each subclass has correct commandName string, accessible by getter
        • Ensure commandName first key of command's name === commandName
          • commandName = 'createIndexes'
          • const cmd: Document { createIndexes: this.collectionName, indexes}
          • potentially use sinon to spy on server.command
        • Ensure commandName accessible through operation.commandName

      Documentation Requirements

      • None

      Follow Up Requirements

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

              Created:
              Updated:
              Resolved: