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

Deprecated Mongo connection options in npm page #340

Open
ericsj opened this issue May 23, 2022 · 5 comments
Open

Deprecated Mongo connection options in npm page #340

ericsj opened this issue May 23, 2022 · 5 comments

Comments

@ericsj
Copy link

ericsj commented May 23, 2022

The following code in the project npm page has deprecated connect() options

beforeAll(async () => { connection = await MongoClient.connect(global.__MONGO_URI__, { useNewUrlParser: true, useUnifiedTopology: true, });

Both connection options used are not present on the reference page

@ericsj ericsj changed the title Deprecated Mongo connect options in npm page Deprecated Mongo connection options in npm page May 23, 2022
@heitorvaldeger
Copy link

heitorvaldeger commented May 24, 2022

@ericsj I have the same problem. Apparently there is no definition in the interface: MongoClientOptions to useNewUrlParser and useUnifiedTopology options

@VictorMeneghini
Copy link

The following code in the project npm page has deprecated connect() options

beforeAll(async () => { connection = await MongoClient.connect(global.__MONGO_URI__, { useNewUrlParser: true, useUnifiedTopology: true, });

Both connection options used are not present on the reference page

Do you have some workaround for that problem?

@josanjohnata
Copy link

m. Apparently there is no definition in the interface: MongoClientOptions to useNewUrlParser and useUnifiedTopology options

I have this same problem can someone resolve this?

@josanjohnata
Copy link

m. Apparently there is no definition in the interface: MongoClientOptions to useNewUrlParser and useUnifiedTopology options

I have this same problem can someone resolve this?

I can resolve with that:


const mongoSetup = require('@shelf/jest-mongodb/setup'); 

module.exports = async function globalSetup() {
  await mongoSetup();
  // process.env.MONGO_URL is now set by
  // https://github.com/shelfio/jest-mongodb/blob/fcda766bfa433644a7383993467ccaa06dfea28b/setup.js#L26
  await mongoose.connect(process.env.MONGO_URL, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useCreateIndex: true,
    useFindAndModify: false,
  });
};

@heitorvaldeger
Copy link

Providing some updates on this issue
According to this issue (mongodb/node-mongodb-native#3792), these options were disabled in version 4.0.0 of the mongodb library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants