For Sitecore, specify MongoDB connections in lower case…

You wouldn’t think this was 2017, but here we are again struggling with upper and lower case again.

In a Sitecore instance I had the following connection string to MongoDB:

<add name="analytics" connectionString="mongodb://mongo.ourserver.local/XXXX_analytics" />

However, something was wrong with the instance; installing packages on it didn’t work (which is VERY strange – why does it need MongoDB? That doesn’t make sense! Anyway…)

Looking in the log, I found:

36404 00:00:26 ERROR Exception when executing agent processing/taskAgent
Exception: MongoDB.Driver.MongoCommandException
Message: Command 'findAndModify' failed: exception: db already exists with different case already have: [xxxx_tracking_live] trying to create [XXXX_tracking_live] (response: { "errmsg" : "exception: db already exists with different case already have: [xxxx_tracking_live] trying to create [XXXX_tracking_live]", "code" : 13297, "ok" : 0.0 })
Source: MongoDB.Driver
at MongoDB.Driver.Operations.CommandOperation`1.Execute(MongoConnection connection)

Ah. So MongoDB would happily:

  • Try to find the repository with the name containing capitals (“XXXX_analytics”)
  • Correctly fail (repository doesn’t exist), and then create the repository with the name rendered to lower case (“xxxx_analytics”)
  • Try to find the repository with the name containing capitals again (“XXXX_analytics”)
  • Incorrectly fail to find the repository due to the case difference, and then try to create the repository a second time with the name renadered to lower case.

This is stupid. If one method ignores case, so should the others.  I don’t mind which way it works – obey or ignore case – but it needs to be consistent.

Advertisements
For Sitecore, specify MongoDB connections in lower case…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s