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

Investigate NODE-3841 - Typescript cursor projection should be strongly typed

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

      NODE-3841 Description

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

      Using https://github.com/mongodb/node-mongodb-native through typescript

      What is the feauture/improvement you would like?

      The signature for `FindCursor<TSchema = Document>` `project` is
       
      ```

      project<T extends Document = Document>(value: Document): FindCursor<T>;

      ```

      I think this should be 

      ```

      project<T extends TSchema>(value: Toggle<T>): FindCursor<T>;

      ```

      where `Toggle<T> = {[keyof T]: 0 | 1}` has the right values.

      What use case would this feature/improvement enable?

      Better type safety for projections.

            Assignee:
            bailey.pearson@mongodb.com Bailey Pearson
            Reporter:
            dbeng-pm-bot TPM Jira Automations Bot
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: