jest-mongodb
jest-mongodb copied to clipboard
Deprecated Mongo connection options in npm page
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 I have the same problem. Apparently there is no definition in the interface: MongoClientOptions to useNewUrlParser and useUnifiedTopology options
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?
m. Apparently there is no definition in the interface: MongoClientOptions to useNewUrlParser and useUnifiedTopology options
I have this same problem can someone resolve this?
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,
});
};
Providing some updates on this issue According to this issue (https://github.com/mongodb/node-mongodb-native/pull/3792), these options were disabled in version 4.0.0 of the mongodb library.