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

Investigate NODE-4007 - Apparent bug in typing

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Not Needed

      NODE-4007 Description

      How are you using Mongo? What version of the server and driver are you using?

      I'm using the npm mongodb version 4.2.2.

      What is the feauture/improvement you would like?

      The typing declares `interface FilterOperators<TValue> extends Document { ... }`

       

      I think you mean `interface FilterOperators<TValue extends Document > { ... }`

      What use case would this feature/improvement enable?

      Currently, `findOne<TSchema> (filter: Filter)` can accept anything as it's arguement (not much type safety).  This is because `Filter` extends `RootFilterOperators` which extends `Document`:

      ```
      Filter<TSchema> =

      { [P in keyof WithId<TSchema>]?: Condition<WithId<TSchema>[P]>; }

      & RootFilterOperators<WithId<TSchema>>;
      ```

      I think you mean for `RootFilterOperators` to only be a bunch of keys that start with "$" (e.g. `$eq`, `$gt`, etc ...).

            Assignee:
            daria.pardue@mongodb.com Daria Pardue
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: