Projection doesn't change TS return type of the query

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Do
    • Priority: Minor - P4
    • None
    • Affects Version/s: 4.12.1
    • Component/s: None
    • 1
    • Not Needed
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      What problem are you facing?

      When using projection, the resulting object will only have the properties specified as `1` and the _id unless it is passed as `-1`. This is, however, not represented in the TS types as these remain unchanged whether you use projection or not. It would be quite helpful to have these changes reflected on the types if possible

      What driver and relevant dependency versions are you using?

      Node.js 18.12.1, Typescript 4.9.3, MongoDB 4.12.1

      Steps to reproduce?

      1. Make a find query on a typed collection
      2. Observe how the return type of the query is the type that you defined the collection as, and not a shorter version of that type (possibly with the Pick type from TS)

            Assignee:
            Bailey Pearson
            Reporter:
            Rodrigo Leitão
            None
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: