Fix: "Username containing an unescaped at-sign Issue" in MongoDB

May 07, 2021

Getting issue when connecting to your MongoDB using mongoose or some other ORM?

fix username containing an unescaped at sign issue

Well, it turns out your password has @ or another unsupported character in it.

We need to escape that password. In our case, it’s @ in the password.

Just replace @ sign to %40 (in your password string)

For example:

Before

mongodb://username:password@@example.com:25010/db

After escaping

mongodb://username:password%40@example.com:25010/db


👋 I'm Ashik Nesin • Sr. Frontend Engineer @Chargebee 👨‍💻• I write about modern Javascript & building web apps

© 2021 Nesin Technologies LLP