Hi Vishesh,
A MongoDB connection string is a URI. You can escape special characters using standard URI escape mechanism.
If your password contain a & you could encode it as %26. For example in NodeJS you could do:
MongoClient.connect("mongodb://user:pas%26word@localhost:27017/databaseName?authSource=databaseName&authMechanism=SCRAM-SHA-1", function(err, db)
{ if (err) throw err;
else console.log(db);
}
);
Also see Percent-encoding for more info.
If you are still having this issue, could you provide:
Regards,
Wan.