There's no problem as 'I could connect' to it.
I could connect to it
Me, someone you don't know, someone who is most probably in the opposite side of the world
Someone who could potentially be a person with bad intentions(although I am not).
It was probably a connection problem(due to bad internet or something) but the bigger problem is
I could connect to it
So maybe you would want to leave the MongoDB URI part out before you make it public for everyone to see, unless you want an evil person to steal user-infos, session datas, and what not from your database.
Happy learning!!!
Edit after the comment
Here's what you should learn to get started in mongoose:
-setting up initial(also called default) connection with mongoose.connect()
-configuring schemas with mongoose.Schema()
-compiling models with schemas with mongoose.model()
-saving the doc with mongoose.save()
-querying the database(findOne, find, deleteOne, updateOne, findById are the
ones I find most used)
And maybe when you get used to all those, you can move to learning populate(you're probably gonna need it in larger projects), creating multiple connections and export schema pattern, validation, middlewares of mongooseJs and many more that I'm sure you'll look into by yourself.
As for the "can you tell me how had you got connected to the atlas?":
I just copied your code and ran in on my computer. Simple as that. That string in dbURI variable is a way to connect to your database atlas. You gave it to me, I used it and connected to it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…