Getting mongoose.connect error

const mongoose = require(‘mongoose’)
mongoose.connect(“mongodb+srv://mitanshikshatriya:@cluster0-ju3qn.mongodb.net/exercise-track”,function(err){
if(err){
console.log(err)
}else{
console.log(“connected!”)
}
})
Error: Invalid mongodb uri “mongodb+srv://:@cluster0-ju3qn.mongodb.net/exercise-track”. Must begin with “mongodb://”

i am using this code to connect my glitch app to mongodb atlas and I have been getting error (Must begin with “mongodb://”). Can somebody help me with connection of atlas to glitch app.

I think the issue is with the +srv you’ve added here. Have you tried using mongodb://mitanshikshatriya:@cluster0-ju3qn.mongodb.net/exercise-track?

No i didnt try. As of now the error has been corrected. I just had to update mongoose to the latest version.
npm update mongoose. Thanks for the suggestion.

1 Like