loopback-connector-mongodb icon indicating copy to clipboard operation
loopback-connector-mongodb copied to clipboard

mongodb driver 4.x support for Mongo Altas Serverless

Open apocist opened this issue 4 years ago • 6 comments

Suggestion

I suggest updating the dependency for MongoDB nodejs driver ^4.1.0

Use Cases

The latest MongoDB driver allow access to MongoDB Altas cloud infrastructure and loadBalanced databases. Connection to this atlas service is impossible with the 3.x series at this time.

Examples

https://github.com/mongodb/node-mongodb-native/blob/4.0/docs/CHANGES_4.0.0.md https://github.com/mongodb/node-mongodb-native/releases/tag/v4.1.0

Acceptance criteria

TBD - will be filled by the team.

apocist avatar Aug 17 '21 19:08 apocist

@apocist, thanks for your suggestion. Would you like to submit a PR?

dhmlau avatar Aug 19 '21 23:08 dhmlau

+1 add on a complete refactor of the ogre that is https://github.com/loopbackio/loopback-connector-mongodb #mongoDBCloudIsHot

CNSKnight avatar Aug 20 '21 00:08 CNSKnight

I've already actually made a working version for some projects at https://github.com/Sitetheory/loopback-connector-mongodb/tree/mongodb-driver-4.x that can be tested via npmjs with @sitetheory/loopback-connector-mongodb

full tests aren't complete and will break 3.x compatibility (due to driver changes), but I can make a PR now if wanted (can do so in morns)

apocist avatar Aug 20 '21 00:08 apocist

I've checked the version from @apocist and it is working properly as expected with mongodb driver 4.x, I also have checked PR https://github.com/loopbackio/loopback-connector-mongodb/pull/639 that has been closed by the stale bot.

Don't know the exact reason but since I don't know @apocist availability to reopen it I'm going to open a new one between today/tomorrow with his changes so we can continue discussion and implement anything required to make the official connector running with driver version 4.x, required as mentioned to use MongoDB Atlas connections and loadBalance option.

arsa-dev avatar May 12 '22 10:05 arsa-dev

I've since stopped maintenance on the #639 changes as we've moved away from using Mongo Altas Serverless due to some limitations, but it's usages still seems effective with mongodb ^4.1.0

apocist avatar May 12 '22 17:05 apocist

One day later than expected, but I've finally created promised pull request #672 with only one pending to check test, failing due to bson.ObjectId upgrade that cause object instances to be indetectable to lodash isEmpty function.

This generates a new unwanted behaviour on model relationships when filtering by only one resulting id property instance after intersect possible ids and where filter one(s). Since ObjectId instances are now indetectable to isEmpty function current loopback-datasource-juggler repo logic assumes that is not needed to send query to connector since at his eyes cannot be a result so immediately fire callback with empty result.

arsa-dev avatar May 15 '22 01:05 arsa-dev