MongoDB and Mongoose - Create and Save a Record of a ModelMongoDB and Mongoose - Create and Save a Record of a Model error timeout has occured

MongoDB and Mongoose - Create and Save a Record of a ModelMongoDB and Mongoose - Create and Save a Record of a Model error timeout has occured
0
#1

I am getting the error timeout has occured


any help will be appreciated

#2

Somebody plssssssssssssssss help

#3

Hi, I’ve noticed that you are using starter file from Node section and not the starter file from MogoDB section. Maybe that could be the problem?

#4

I don’t understand?!?!?!?!

#5

https://learn.freecodecamp.org/apis-and-microservices/mongodb-and-mongoose

#6

I dont think that is the problem because i did click on that llink

#7

when i started these tests

#8

@orvalho
Can you please post the solution as I have been stuck on this for 20 days!
:pleading_face:

#9

Looked into your code. Noticed that your app isn’t connected to DB.

You can check connection like so:

console.log(mongoose.connection.readyState);

ready states being:

  • 0: disconnected
  • 1: connected
  • 2: connecting
  • 3: disconnecting

So the problem is that your app isn’t connected to DB.
One possible solution: check your .env file - did you replaced <password> with actual password?

#10

No i did not

#11

@orvalho
Now i am getting error item.name should be a string

#12

When I console.log(mongoose.connection.readyState); in the logs I’m still seeing 0 (meaning DB is disconnected).

Did you whitelisted all IPs when you created the DB?