Problem connecting to MongoDB
I've been doing an app in Angular, mongodb, express and using mongoose.
Until today I had no problems accessing my Atlas db.
I was using:
mongoose.connect("mongodb+srv://
Today I got connection failures and this deprecation warnings:
(node:37532) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect. (node:37532) 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 tryed using the connection string like:
mongoose.connect("mongodb+srv://
and also
mongoose.connect("mongodb+srv://
But nothing works. Does anyone has any ideas?
Warning still persists for me as well if i set {useUnifiedTopology: true }
@joaobonifacio are you using any other MongoDB-related modules, like connect-mongo or connect-mongodb-session? Try running npm list | grep "mongo".
Also, please read our deprecation warning docs
@vkarpov15 see screen below. Im one node 12 and mongoose 5.9.7. Im connecting to replicaSet.
Even after passing the option the warning still persists.
Just a shot in the dark, I've seen a couple of issues here where people had connection issues with Atlas that I wasn't able to reproduce, they turned out to be issues with their ISPs blocking Atlas for some reason.
Try changing your DNS to Google's 8.8.8.8, or try a VPN to see if the problem still persists.
EDIT: Oh, I didn't read that carefully enough, this is about the deprecation warnings, not a connection failure issue.
Yes. I Read the docs. Did as recommend and the warning still persisted. As shown in the screenshot. @AbdelrahmanHafez
@Enado95 you did not answer my question. Run npm list | grep "mongo" and paste the output.
See below @vkarpov15
OK. Can you paste the code you're using to initialize winston-mongodb? This warning could be coming from that library as well.
That is in fact correct. The option was missing from that (winston-mongodb) connect method.