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

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

    • Type: Icon: Task Task
    • Resolution: Gone away
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Not Needed

      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" } }

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

              Created:
              Updated:
              Resolved: