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
DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor. #8156
Comments
Same is happening to me. There is also your thread about it on StackOverflow: https://stackoverflow.com/questions/57895175/server-discovery-and-monitoring-engine-is-deprecated/57899638#57899638 |
This works fine for me, and no more errors. mongoose |
I was facing the same error and "useUnifiedTopology: true" fixed, thanks! It's already updated on the readme of the repo btw |
Adding the useUnifiedTopology: true to the object after my connection URL worked just as you suggested though I was using MongoClient. Thanks! |
It still error:
It output:
Anyone can help me? Thanks! |
@jiobiagba Yes i have tried your solution now my node.js server is not showing me any error simply it is showing 'The Server Is Running On Port:7070'. Thanks for the solution hope no error will come. |
I was having the same problem and when inserting useUnifiedTopology: true, stopped showing terminal error. Folow code: mongo() { |
This parameter does not work with our replica set URL: error:getaddrinfo ENOTFOUND .xyz.net .xyz.net:12345 Are there any replica set changes needed on top of this parameter? |
@cbratschi can you please explain in details cause i want exact error and code so further i can try to help you. |
I too faced the same issue and after inserting useUnifiedTopology: true, I don't face any errors, but the console log in the .then() block does not get executed. mongoose.connect(MONGODB_URI,{ useNewUrlParser: true, useUnifiedTopology: true }) |
@guhandelta none of code is executing (.then() and .catch()) ? |
I only see these lines in the log message and the stacktrace contains the same information:
This is the URL we are using (anonymized): mongodb://user:pwd@abc.xyz.net:27018,.xyz.net:27019,.xyz.net:27020/account?replicaSet=mongors&readPreference=primaryPreferred Update: it works if the abc sub-domain part is repeated in the URI. For instance: mongodb://user:pwd@abc.xyz.net:27018,abc.xyz.net:27019,abc.xyz.net:27020/account?replicaSet=mongors&readPreference=primaryPreferred |
@cbratschi can you please review your code once cause it will direct give the idea here the error is saying the same.it might possible that you are leaving some code for handling catch or async code or you might have missed promise which is compulsory in non-blocking. |
Hello, I have:
When it starts I get at the console: |
The subdomain was not parsed correctly in the implementation. Switching to full domains it works fine now (see my last comment). So the implementation is not fully standard compliant. |
I was using the method indicated in this link, but it didn't work. After using the useUnifiedTopology option in the mongoose.connect() it worked! |
I found my way here because I am having the same problem - I just switched to the latest version of mongodb, and I get the warning. I added useUnifiedTopology to the options passed to the MongoClient constructor, but the warning persists. The connection to the remote database seems fine, the operations are succeeding and there are no other error messages or warnings. My url is: mongodb://myUsername:myPassword@myHostName.org:27017/myDatabaseName |
I fixed this bug with this: mongoose.connect('mongodb+srv: {...}', { |
Please follow the instructions on the docs here: https://mongoosejs.com/docs/deprecations.html |
Hi, I just downloaded latest version of mongoose from npm and tried to run it but it gave me this warning:
DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
i added this option to my configuration but it still gives me this warning. here is my configuration
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useFindAndModify: false, useCreateIndex: true, useUnifiedTopology: true }).then(()=>{ console.log(
connection to database established) }).catch(err=>{ console.log(
db error ${err.message}); process.exit(-1) })
any clue?
The text was updated successfully, but these errors were encountered: