1

On an installation of Sitecore 8.2 update 4, the mongo connection appears to work fine. After upgrading to Sitecore 8.2 update 6 mongo is stating that the connection string is not valid.

The connection string 'mongodb://username:password@servername.fleet.mongolab.com:port138192/databasename?replicaSet=rs-servername;ssl=true' is not valid.

What may have happened to cause this and how can I get it working?

6

The MongoDB driver between the two version changed, which includes a refactoring of the validation for connection strings.

Checking with MongoDB.Driver.dll the version details can be seen as the following:

  • Sitecore 8.2.4 the MongoDB driver is 1.10.0.62
  • Sitecore 8.2.6 the MongoDB driver is 2.4.4.0

Each file uses a regular expression to verify the format of the connection string. I discovered that the password I was provided has a colon : in it which needs to be escaped.

abc:123

The solution here is to encode the colon using %3A.

abc%3A123

Similarly, if you have an @ symbol you should replace it with %40.

Note: Only encode the password. The : and @ are also used in the connection string as delimiters which should go untouched.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.