Skip to content

Add support for mongodb driver v4 #7907

@ferenckv

Description

@ferenckv

Issue Description

Exactly in this commit mongodb stopped exporting a Cursor object.

Because of that, every reference to ParentCursor.Prototype in MongoEntityManager (like here) is failing with error "Cannot read property 'prototype' of undefined".

Expected Behavior

No error expected.

Actual Behavior

Error "Cannot read property 'prototype' of undefined"

TypeError: Cannot read property 'prototype' of undefined
    at FindCursor.cursor.toArray (/entity-manager/MongoEntityManager.ts:679:37)
    at MongoEntityManager.<anonymous> (/entity-manager/MongoEntityManager.ts:97:23)
    at step (/node_modules/tslib/tslib.js:143:27)
    at Object.next (/node_modules/tslib/tslib.js:124:57)
    at fulfilled (/node_modules/tslib/tslib.js:114:62)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Steps to Reproduce

  1. Add typeorm dependency
  2. Add mongodb v4 dependency.

My Environment

Dependency Version
Operating System Ubuntu 18.04 on wsl2
Node.js version v14.17.0
Typescript version v4.0.8
TypeORM version v0.2.34

Additional Context

Relevant Database Driver(s)

  • aurora-data-api
  • aurora-data-api-pg
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time, and I know how to start.
  • Yes, I have the time, but I don't know how to start. I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions