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 • Principal Software Engineer @Chargebee 👨‍💻• I write about web development & behinds the scenes of startup/side projects that I'm building

© 2022 Nesin Technologies LLP