Tell us what’s happening:
I cannot seem to pass the third test on the first challenge of MongoDB and Mongoose. Keeps on saying ’ “mongoose” should be connected to a database’. However I can see an active connection on the MongoDB Atlas database. Anyone experiencing the same issue or able to assist?
I have this error on the console : “(node:754) 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 Command-line options | Node.js v16.9.1 Documentation). (rejection id: 1)
(node:754) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.”
There is also this "warning " in the editor which I do not understand: "[typescript]
Could not find a declaration file for module ‘mongoose’. ‘/home/runner/boilerplate-mongomongoose/node_modules/mongoose/index.js’ implicitly has an ‘any’ type.
Try npm install @types/mongoose if it exists or add a new declaration (.d.ts) file containing declare module 'mongoose';"
I have added mongoose onto the package manager. I really don’t understand what the issue is.
And you have set your MONGO_URI in the Secrets tab? Does it look something like this: mongodb+srv://<username>:<password>@cluster0.tdkk7.mongodb.net/<database_name>?retryWrites=true&w=majority ?
Thanks for all the help. The URI was not the problem.
I have deleted the old Replit, loaded a new Replit starter but this time I added the required dependencies via the “search to install package”. They also seem to be of higher versions that the ones required on the challenge. It worked