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

Investigate NODE-4450 - Better typings for updating / querying nested objects

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Unknown
    • Resolution: Gone away
    • None
    • None
    • None
    • Not Needed

    Description

      NODE-4450 Description

      What problem are you facing?

      Currently, querying / updating deeply nested fields works perfectly, as long as those fields aren't objects themselves.

       

      When they are objects:

      • Querying ignores type validation
      • Updating errors

      What driver and relevant dependency versions are you using?

       

      4.8.0

      Steps to reproduce?

       

      Create a type:

      type User = {
        pet: {
          name: {
            first: string;
            last: string;
          }
        }
      }
       
      // This works when it shouldn't
      const query: mongodb.Filter<User> = { "pet.name": { first: 1 } };
       
      // This doesn't work when it should
      const update: mongodb.UpdateFilter<User> = { "pet.name": { first: "a", last: "b" } }

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: