I have a problem with URL Shortener Microservice Project. I am struggling with MongoDB I guess. I am not even sure if my connection is working. I’ve spent whole weekend with this but my API always freezes or shows nothing.
I have no idea how to correctly work with MongoDB, they changed the connection string syntax now and some other stuff. (https://www.mongodb.com/blog/post/mongodb-3-6-here-to-SRV-you-with-easier-replica-set-connections)
So please if somone can give me some advice where to look and how to understand this mongodb concept
I will be very thankful guys
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36.
I changed it as you recommended but it’s still not working unfortunately. When I press POST URL button, response is correct only regarding URL validity (regex & dns check) but find in DB is obviously not working.
Then I tried to change the dependencies but it stopped working completely…so I am not sure what to do, start once again from the beginning?
When I try to run your latest version using a url which looks like the following, I get an error because of the version of mongo you are using in the package.json. If I switch it to a newer version, then I do not get the error.
I was using just mongodb so I added srv
and then update dependencies
But I see error like this now:
TypeError: connection.model is not a function
at Object.exports.initialize (/rbd/pnpm-volume/3231a0e3-c114-42cd-8803-7a554bc5bc70/node_modules/.registry.npmjs.org/mongoose-auto-increment/5.0.1/node_modules/mongoose-auto-increment/index.js:10:34)