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

Loopback-Connector-MongoDB fails connecting to Atlas due to still using mongodb 3.7 driver #8700

Closed
jricardooliveira opened this issue Jun 21, 2022 · 3 comments
Labels
bug db:MongoDB Topics specific to MongoDB

Comments

@jricardooliveira
Copy link

Describe the bug

Hi,

When trying to connect with cluster protocol to mongodb with the URI mongodb+srv:// after npm migrate it will fail with:

"Cannot migrate database schema MongoParseError: Load balancer mode requires driver version 4+"

Despite loopback-connector-mongodb documentation shows support for mongodb+srv the problem is that the node_module that comes with loopback-connector-mongodb (even with 6.2.0) is the mongodb package 3.7.0 and not 4.x ...

In reality loopback-connector-mongodb does not support mongodb+srv:// URI may be to that issue.

To replicate just create a lb4 application, add a mongodb datasource but instead of using mongodb:// try using the mongodb+srv URI for instance that is the ones available for MongoDB ATLAS Cloud service.

Thanks
Joao

Logs

Migrating schemas (alter existing schema)
Cannot migrate database schema MongoParseError: Load balancer mode requires driver version 4+
    at QueryReqWrap.callback (~project/node_modules/loopback-connector-mongodb/node_modules/mongodb/lib/core/uri_parser.js:111:27)
    at QueryReqWrap.onresolve [as oncomplete] (node:dns:215:10)

Additional information

Connection config:

const config = {
name: 'pinnersDS',
protocol: 'mongodb+srv',
url: 'mongodb+srv://myuseradm:[email protected]/?retryWrites=true&w=majority',
useNewUrlParser: true
};

Reproduction

Obvious enought

@achrinza
Copy link
Member

Thanks for opening an issue, @jricardooliveira. It's something that's been under our radar for a while, but didn't have the resources to execute earlier.

There' currently an open PR that may interest you: loopbackio/loopback-connector-mongodb#672

@achrinza achrinza added the db:MongoDB Topics specific to MongoDB label Jun 26, 2022
@achrinza
Copy link
Member

I'll proceed to close this issue in favour of loopbackio/loopback-connector-mongodb#638, which should cover the same things.

@achrinza
Copy link
Member

Duplicate of loopbackio/loopback-connector-mongodb#638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug db:MongoDB Topics specific to MongoDB
Projects
None yet
Development

No branches or pull requests

2 participants