Mongoose version 5.0.2 vs 7.0.1

i downloaded mongoose without paying attention to the version . The latest version (7.0.1) was installed and listed as a dependency in package.json

In section 8 of the Node course, there is a project named ‘vidly’. To connect to the database we use

I got error "cannot connect to mongo database’

When i checked the exercise solution i noticed that mongoose v.5.0.2 was being used. Installing the earlier version solved the connection problem.

According to ChatAI, v.7 caused a breaking of the connection. Check ChatAi with this query…

“why does mongoose.connect not work with mongoose version 7”

i am experiencing the same problem. i’m on section 7 of the node course…

Hello its Harvel, use this it will work :

mongoose.connect(“mongodb://” )

Actually for enlightenment refers to the local host

from mongoose v5.0.2 to v7 the connect method changed from mongoose.connect(mongodb://localhost… to mongoose.connect(mongodb://… unless you want to use IPV6 protocol because by default localhost represents for IPV6 not IPV4. If you want to use localhost word then switch to IPV6, because machines are usually set to IPV4 by default