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

Apparent bug in typing

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Not Needed

      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:
            Unassigned Unassigned
            Reporter:
            tianhui.michael.li@gmail.com Tianhui Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: