Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for mongodb driver v4 #7907

Closed
2 of 21 tasks
ferenckv opened this issue Jul 15, 2021 · 19 comments · Fixed by #9450 · 4 remaining pull requests
Closed
2 of 21 tasks

Add support for mongodb driver v4 #7907

ferenckv opened this issue Jul 15, 2021 · 19 comments · Fixed by #9450 · 4 remaining pull requests

Comments

@ferenckv
Copy link

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.
@imnotjames
Copy link
Contributor

Currently, TypeORM is only compatible with mongo node v3.

@pleerock pleerock changed the title Error "Cannot read property 'prototype' of undefined" using mongodb v4 Add support for mongodb driver v4 Jul 20, 2021
@pleerock
Copy link
Member

Looks like we need to upgrade dependency and fix all related issues. This issue is opened for contributions!

@imnotjames
Copy link
Contributor

Looks like we need to upgrade dependency and fix all related issues. This issue is opened for contributions!

The API has changed enough that it will cause breakages downstream. For now we should pin it to 3 in the peer, I think.

@dvantage
Copy link

dvantage commented Jan 4, 2022

Guys, a lot of time has passed since the release of the 4th version of the driver, full support is needed

@MatheusMeloAntiquera
Copy link
Contributor

Guys, a lot of time has passed since the release of the 4th version of the driver, full support is needed

I will try to fix my PR soon

@mschnee
Copy link

mschnee commented Jan 13, 2022

🚨🚨🚨
Customers using certain tiers of MongoDB Atlas are being force-upgraded to MongoDB 5 this month as Mongo is dropping support for older databases. The minimum driver version supported is 4.0.
https://docs.mongodb.com/drivers/node/current/compatibility/
🚨🚨🚨

@arnabrahman
Copy link

This version update is a necessity. Mongodb is force migrating to v5 in mid feb 2022.

@Shayan-To
Copy link

Any updates on this? Any time window when this will be available?

MatheusMeloAntiquera added a commit to MatheusMeloAntiquera/typeorm that referenced this issue May 3, 2022
This new fix allow support to mongodb driver v4

Closes: typeorm#7907
MatheusMeloAntiquera added a commit to MatheusMeloAntiquera/typeorm that referenced this issue May 3, 2022
This new fix allow support to mongodb driver v4

Closes: typeorm#7907
MatheusMeloAntiquera added a commit to MatheusMeloAntiquera/typeorm that referenced this issue May 3, 2022
This new fix allow support to mongodb driver v4

Closes: typeorm#7907
MatheusMeloAntiquera pushed a commit to MatheusMeloAntiquera/typeorm that referenced this issue May 3, 2022
This new fix allow support to mongodb driver v4

Closes: typeorm#7907
MatheusMeloAntiquera pushed a commit to MatheusMeloAntiquera/typeorm that referenced this issue May 3, 2022
This new fix allow support to mongodb driver v4

Closes: typeorm#7907
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment