Investigate NODE-4007 - Apparent bug in typing

XMLWordPrintableJSON

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

      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
              Reporter:
              TPM Jira Automations Bot
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: