Hello,
We have passwords that contain the special characters like "@" that is one of the MongoDB delimiters. We call the mongoengine.connect with
kwargs = { 'host': connection_string }
connection_string = is the URL like 'mongodb://%(username)s:%(password)s@%(server)s:%(port)s/%(db_name)s'
connect(DB_NAME, alias=DB_ALIAS, **kwargs)
or
connect(DB_NAME, alias=DB_ALIAS, **creds)
where creds are a set of keys and their values
username:;;
password:..
However, when a special character like "@" is in the password, the connect will not be able to establish a connection. It did not throw an exception immediately.
But when I tried to use the DB connection to query from the DB to write to the DB, I got the exception that it does not have a default connection to the DB.
For MongoClient, I could just use urllib.quote to encode the URL, and it will work fine with such a password.
But the same technology failed in the mongoengine.connect. I also tried re.escape, it did not work.
Anyone has any ideas how to resolve the issue?
Thanks,
Teddy