I am just trying to create an API and connect to it inside my app.js file but every time I run app.js I am getting this deprecation warning. I have checked all of the deprecation warnings in mongoose and MongoDB but I cannnot find any that match mine. The warning that I am getting is,
(node:16864) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:16864) DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version.
Why am I getting this deprecation warning and how can I remove it?
I guess this warning occurs with mongoose 5.11.16 version. If you want to avoid seeing them until the bug gets fixed, instead you can go for mongoose version 5.11.15. Uninstall mongoose 5.11.16 and install npm install mongoose@5.11.15
Ya Its correct mongoose version problem. so please 5.11.16 version change to 5.11.15 version.
npm install --save mongoose@5.11.15
The problem is with the new version which is above 5.11.15
Check your version by running:
npm list | grep "mongoose"
Then move to version 5.11.15 by running:
npm install --save mongoose@5.11.15
It worked that way.