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

Add a way to strongly type cursors that have transform functions defined

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.0.0
    • Affects Version/s: None
    • Component/s: None
    • Not Needed

      Currently if you call cursor.map(). There is no way to change the type that .next() returns based on the provided transform. We mitigate this problem by permitted user overrides in the various iteration methods.

      Example:

      Unable to find source-code formatter for language: typescript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      const cursor = db.collection<Pet>().find().map(pet => pet.age)
      cursor.next() // still returns Pet
      cursor.next<number>() // Overridable generic parameter
      

            Assignee:
            eric.adum@mongodb.com Eric Adum (Inactive)
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: