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

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 4.9.0
    • Affects Version/s: None
    • Component/s: TypeScript
    • Labels:
    • 0
    • Not Needed

      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
      

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

              Created:
              Updated:
              Resolved: