Skip to content

Deprecated Mongo connection options in npm page #340

New issue

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

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

Already on GitHub? # to your account

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

Deprecated Mongo connection options in npm page #340

ericsj opened this issue May 23, 2022 · 4 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,
  });
};

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

No branches or pull requests

4 participants