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

node-mongodb-native - PR #3349: Fix type for nested objects in query & update

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 4.9.0
    • TypeScript
    • 0
    • Not Needed

    Description

      jer-sen has created PR #3349: Fix type for nested objects in query & update in node-mongodb-native


      PR description

      Fix type for nested objects in query & update added in https://github.com/mongodb/node-mongodb-native/pull/3328

      What is changing?

      • Support union types (... extends unknown ? ... : never)
      • Fail if path is wrong (never vs unknown)
      • Support array operators in the middle of a path (number replaced by number | `$${'' | `[${string}]`}` and NestedPathsOfType removed)

      What is the motivation for this change?

      const _: MatchKeysAndValues<{ aaa: readonly { bbb: 'ccc' }[] }> = { 'aaa.$.bbb': 'ccc' }; // Error
      const _: MatchKeysAndValues<{ aaa: { bbb: { ccc: 'ddd'[] }[] }> = { 'aaa.$.bbb.$[arrayFilter]': 'ddd' }; // Error
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dbeng-pm-bot PM Bot
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: