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

Investigate NODE-4594 - v4 query type checking adversely impacts environments with advanced document types

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

      NODE-4594 Description

      What problem are you facing?

      TypeScript processing (type checking and transpilation) is severely slowed down when types with high count of unique key names, enum values, type unions, and recursion are passed to MongoDB collection methods.

      TypeScript processing ultimately fails with the following errors most prevalent:

      error TS2589: Type instantiation is excessively deep and possibly infinite.
      error TS2615: Type of property 'prop49' circularly references itself in mapped type 

       

      What driver and relevant dependency versions are you using?

       

      bson: ~4.7.0
      mongodb: ~4.9.0
      typescript: ~4.8.2

       

      Steps to reproduce?

      Please consult minimal reproduction repository:
      https://github.com/thinkalpha/node-mongodb-typechecking-performance

      Install dependencies ( npm i ) and run npm exec tsc --incremental false to reproduce the issue. Consult class.ts for Driver call sites and the individual model types for additional detail. The "circular" reference example is minimal, while the "slow" example is an anonymized real-world data model. Both employ recursive types.

       

            Assignee:
            daria.pardue@mongodb.com Daria Pardue
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: