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

Allow update to supply sort option

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.17.0
    • Affects Version/s: None
    • Component/s: CRUD
    • 3
    • 0
    • Hide

      DRIVERS-2822:
      Summary of necessary driver changes

      Commits for syncing spec/prose tests
      (and/or refer to an existing language POC if needed)

      Context for other referenced/linked tickets

      •  
      Show
      DRIVERS-2822: Summary of necessary driver changes Add a sort option to updateOne and replaceOne operations so if it matches more than one candidate document the first one matched by the sort order will be updated. The upstream server changes are at  https://jira.mongodb.org/browse/SERVER-78140 . See example change in the Python driver: https://github.com/mongodb/mongo-python-driver/commit/6f4258c1cdb95f6fe624a66760a66423048b6884 Commits for syncing spec/prose tests (and/or refer to an existing language POC if needed) https://github.com/mongodb/specifications/commit/da8e120514fd5e7a5934513f4fb7a63c7cadbb43 adds spec tests for updateOne, replaceOne, collection-level bulk write, and the bulkWrite command. https://github.com/mongodb/specifications/commit/24817a5caa0526725d480f9a8b3fbb8714507311 adds skips for clientBulkWrite tests on Serverless. Context for other referenced/linked tickets  
    • Needed
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      This ticket was split from DRIVERS-2822, please see that ticket for a detailed description.


      Use Case

      As a... Node.js driver user
      I want... to be able to control the document order that is used when matching a filter for updateOne and replaceOne operations
      So that... when a filter matches many documents the order is consistent

      User Experience

      • What is the desired/expected outcome for the user once this ticket is implemented?
        • Wherever updateOne and replaceOne operations are possible a sort can be attached. (ex. coll.updateOne() and client.bulkWrite([updateOne])

      Dependencies

      • None

      Risks/Unknowns

      • None

      Acceptance Criteria

      Implementation Requirements

      • Add typescript support for Sort on:
        • coll.updateOne and coll.replaceOne options
        • client bulkWrite updateOne and replaceOne operations
        • collection bulkWrite updateOne and replaceOne operations
      • Ensure updateMany does not support a sort option
      • Sync spec tests and ensure sort option is attached to the respective commands if specified
      • Update the Sort type definition to work correctly for readonly versions of supported configurations (ex. A (readonly) tuple of a field name to sort direction)

      Testing Requirements

      • Spec tests
      • Add typescript tests that illustrate the possible forms a sort configuration can take

      Documentation Requirements

      • The new sort option should have API docs attached

      Follow Up Requirements

      • None

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            dbeng-pm-bot TPM Jira Automations Bot
            Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: