-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
fix: find() throws error while using mongodb #8412
Conversation
Add support for mongodb 4.2 Closes: 8146
Is it the only change that will make TypeORM to work with mongodb@4 ? I thought we should have plenty of other changes as well. For example this pr #7909 |
@pleerock - I took a look through #7909. The first relevant piece of information to note that in version 4.2.1 of the mongodb driver the following has been included back as an export. import { ObjectId } from 'bson';
/**
* @public
* @deprecated Please use `ObjectId`
*/
export const ObjectID = ObjectId; This would explain why much of the changes in #7909 have been omitted. Additionally this PR does not attempt to include those typings provided by the mongodb driver itself (which from that discussion there maybe is not the worst thing). Finally I also notice a change was made in #7909 to So to answer your question, yes this appears to be the only change necessary to make TypeORM work with MongoDB 4. This is not to say it offer full support, there may be (in fact probably are) features in MongoDB that are still not supported, it is probably more accurate to describe this as a compatibility change. Also note that I did not update the peer dependency to require 4.2.1, to be very clear this change enables the use cases: Test Results
Please let me know if you feel any of these omissions should be included and I will take a look at them. |
Thank you for your efforts. Let's merge it and keep tracking if users have other issues that we can resolve that won't break @3 version support. |
You bet! We are overdue a TS native approach for working with mongo, love what you are doing here please feel free to tag me on anything which looks related. |
When can this be released on npm? |
@pleerock Hello, do you have an idea when that will be released? |
Hi, i can hardly wait for this release :) |
Expect to have release this week. |
Add support for mongodb 4.2
Closes: 8146
Description of change
mongodb@4.2 does not export a Cursor, instead it exports a FindCursor. This change provides compatibility support to TypeORM so it works with both mongodb@3.6.4 and mongodb@4.2
Some notes on the tests:
These tests were not passing prior to any changes and were disabled to complete the other tests. The remaining tests were ran successfully for both MongoDB version 4.4.10 using mongdb@4.2 driver and using MongoDB version 3.7 (using the docker image) and mongodb@3.6.4 driver.
Pull-Request Checklist
master
branchnpm run lint
passes with this changenpm run test
passes with this changeFixes #0000