Mongoose: Can not connect mongo alias

Created on 20 Dec 2017  路  4Comments  路  Source: Automattic/mongoose

Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Can not connect to mongo alias server via mongoose

If the current behavior is a bug, please provide the steps to reproduce.

I got uri from Mongo Alias:
mongodb+srv://my_user_db:[email protected]/test
If I connect via mongodb, it's working:
MongoClient.connect(config.db.MONGODB_CONNECTION, (err, data) => { console.log(err); })
I get this error:
Error: Invalid mongodb uri "mongodb+srv://my_user_db:[email protected]/test". Must begin with "mongodb://"
Please mention your node.js, mongoose and MongoDB version.
Nodejs: 8.9.1
Mongoose: 4.12.5
MongoDB: 3.6

Most helpful comment

@BalasubramaniM This issue was closed by the person who opened it. Presumably they sorted out their own problem.

The 'mongodb+srv' style of url isn't supported by mongoose until version 5.0.15 and beyond. If you're using an older version it won't work. If you're using a compatible version and still can't connect, please open a new issue or seek help in one of these communities:

StackOverflow
Gitter.im
Slack

All 4 comments

Why this issue has been closed without any response? I too getting the same error and need a solution to overcome this.

@BalasubramaniM This issue was closed by the person who opened it. Presumably they sorted out their own problem.

The 'mongodb+srv' style of url isn't supported by mongoose until version 5.0.15 and beyond. If you're using an older version it won't work. If you're using a compatible version and still can't connect, please open a new issue or seek help in one of these communities:

StackOverflow
Gitter.im
Slack

Thanks for a response. It worked after the update (5.0.15).

Not working for me even after updating to 5.0.15

Was this page helpful?
0 / 5 - 0 ratings