Skip to content
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

Mongo connection error #16

Closed
PrettiestRobot opened this issue Oct 18, 2021 · 1 comment
Closed

Mongo connection error #16

PrettiestRobot opened this issue Oct 18, 2021 · 1 comment

Comments

@PrettiestRobot
Copy link

I kept receiving a notification whenever I would run nodemon telling me there was a vulnerability and suggesting I run an audit. I did and it said I should update mongoose to a new version. Ever since the update I'm getting this error and I can't start the server:

connection error: MongoParseError: options usecreateindex, usefindandmodify are not supported
at Object.parseOptions (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongodb\lib\connection_string.js:291:15)
at new MongoClient (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongodb\lib\mongo_client.js:62:46)
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\connection.js:779:16
at new Promise ()
at NativeConnection.Connection.openUri (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\connection.js:776:19)
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\index.js:330:10
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\helpers\promiseOrCallback.js:32:5
at new Promise ()
at promiseOrCallback (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:10)
at Mongoose._promiseOrCallback (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\index.js:1151:10)
(node:12200) UnhandledPromiseRejectionWarning: MongoParseError: options usecreateindex, usefindandmodify are not supported
at Object.parseOptions (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongodb\lib\connection_string.js:291:15)
at new MongoClient (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongodb\lib\mongo_client.js:62:46)
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\connection.js:779:16
at new Promise ()
at NativeConnection.Connection.openUri (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\connection.js:776:19)
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\index.js:330:10
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\helpers\promiseOrCallback.js:32:5
at new Promise ()
at promiseOrCallback (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:10)
at Mongoose._promiseOrCallback (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\index.js:1151:10)
(Use node --trace-warnings ... to show where the warning was created)
(node:12200) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:12200) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejectio

@PrettiestRobot
Copy link
Author

I fixed it. After a quick search on stack overflow, I needed to remove:

usecreateindex
usefindandmodify

from my mongoos.connect function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant